[Message Prev][Message Next][Thread Prev][Thread Next][Message Index][Thread Index]

[MD:2800]NTEmacsen crashed, when expand-file-name.



On Sat, 15 Dec 2001 19:08:04 +0200, "Eli Zaretskii" <eliz@xxxxxxxxxxxxx> said:

> > From: Andrew Innes <andrewi@xxxxxxx>
> > Date: 13 Dec 2001 23:35:59 +0000
> > 
> > I would call GetModuleFileName to find the full location of emacs.exe,
> > and hence a valid drive letter.
> 
> Why is it better to look at the location of emacs.exe instead of the
> current drive?  The former could be a fallback, but why not try
> _getdisk first?

In NT-Emacs, they will give the same answer (or would, except MSVC
doesn't seem to provide a _getdisk function).  I made that change quite
a while ago to avoid problems where Emacs would change its cwd to the
directory where it needs to run or start a subprocess and then leave it
there until the next subprocess is started.

On Windows you cannot delete a directory that is in the path of the cwd
for any process.  So on startup, NT-Emacs changes its real current
directory to the location of emacs.exe and leaves it there, since
obviously you cannot delete that directory while Emacs is running
anyway.

If you prefer, we could remember the current directory that Emacs has
when it starts up, and use that instead as the "hard-coded" default for
expand-file-name.

AndrewI