Jan Vroonhof writes:
It could be a bug in the NT expand-file-name routines (what does
(expand-file-name "test" "~/test/") give under your machines).
(setenv "HOME" "/home/cgw")
(insert (getenv "HOME")) /home/cgw
(insert (expand-file-name "test" "~/test/")) c:\home\cgw\test\test
(setenv "HOME" "C:\\home\\cgw")
(insert (getenv "HOME")) C:\home\cgw
(insert (expand-file-name "test" "~/test/")) c:\home\cgw\test\test
(setenv "HOME" "\\\\reactor\\cgwhome")
(insert (getenv "HOME")) \\reactor\cgwhome
(insert (expand-file-name "test" "~/test/")) c:\home\cgw\test\test
(setenv "HOME" "//reactor/cgwhome")
(insert (getenv "HOME")) //reactor/cgwhome
(insert (expand-file-name "test" "~/test/")) c:\home\cgw\test\test
I do not know the NT port but shouldn't HOME be a directory
including
driveletter since otherwise it is not uniquely specified?
I tried it with HOME=/home/cgw and HOME=C:\home\cgw, get the same
behaviour (No such file or directory, c:\home\cgw\home\cgw\/.autosave)
both ways.
The funny thing is that XEmacs tries to do its best to copy with
funny
HOME values but on NT it seems to be switched of explicitly:
if (IS_DIRECTORY_SEP (nm[1])
|| nm[1] == 0) /* ~ by itself */
{
if (!(newdir = (Bufbyte *) get_home_directory()))
newdir = (Bufbyte *) "";
nm++;
#ifdef WINDOWSNT
collapse_newdir = 0;
#endif
}
The collapse_newdir explicitly tells XEmacs to not consider the fact your
HOME prefix starts with a / and just prepend the current dir which
happened to be c:\home\cgw in your case. It seems bogus to me.
Could you try removing that code and then test what happends to expand
file name in all case. i.e. with
1. HOME includes driveletter
2. HOME does not include drive letter.
3. HOME is a network path
Sorry, I was not completely clear on what code you wanted me to
remove. The 3 lines beginning with #ifdef WINDOWSNT, or the entire
block you quoted above? I tried it both ways.
With the "#ifdef WINDOWSNT" changed to "#ifdef XXXWINDOWSNTXXX"
I get no warnings from make-auto-save-file-name, but clearly wrong
behaviour from expand-file-name:
(setenv "HOME" "/home/cgw")
(insert (getenv "HOME")) /home/cgw
(insert (expand-file-name "test" "~/test/")) c:\test\test
(setenv "HOME" "C:\\home\\cgw")
(insert (getenv "HOME")) C:\home\cgw
(insert (expand-file-name "test" "~/test/")) c:\test\test
(setenv "HOME" "\\\\reactor\\cgwhome")
(insert (getenv "HOME")) \\reactor\cgwhome
(insert (expand-file-name "test" "~/test/")) c:\test\test
(setenv "HOME" "//reactor/cgwhome")
(insert (getenv "HOME")) //reactor/cgwhome
(insert (expand-file-name "test" "~/test/")) c:\test\test
With the entire block removed I get this result:
(setenv "HOME" "/home/cgw")
(insert (getenv "HOME")) /home/cgw
(insert (expand-file-name "test" "~/test/")) c:\home\cgw\test\test
(setenv "HOME" "C:\\home\\cgw")
(insert (getenv "HOME")) C:\home\cgw
(insert (expand-file-name "test" "~/test/")) c:\home\cgw\test\test
(setenv "HOME" "\\\\reactor\\cgwhome")
(insert (getenv "HOME")) \\reactor\cgwhome
(insert (expand-file-name "test" "~/test/")) c:\home\cgw\test\test
(setenv "HOME" "//reactor/cgwhome")
(insert (getenv "HOME")) //reactor/cgwhome
(insert (expand-file-name "test" "~/test/")) c:\home\cgw\test\test
(1) (warning/warning) Error caught in `make-auto-save-file-name':
Creating directory: Invalid argument, c:\home\cgw\½/.autosave
(2) (warning/warning) Error caught in `make-auto-save-file-name':
Creating directory: Invalid argument, c:\home\cgw\p»/.autosave