diff options
| author | Eli Zaretskii <eliz@gnu.org> | 2018-12-07 10:54:57 +0200 |
|---|---|---|
| committer | Eli Zaretskii <eliz@gnu.org> | 2018-12-07 10:54:57 +0200 |
| commit | e4a8f6ebbf4e8cf4d87d5b7b9940b61b51073fd3 (patch) | |
| tree | 9fa8559e3e0c6cd38625eba0ccff94144d4e0691 /src/emacs.c | |
| parent | bcd74314626db88a8ff3c9deeb6ea7fbcd337413 (diff) | |
| download | emacs-e4a8f6ebbf4e8cf4d87d5b7b9940b61b51073fd3.tar.gz | |
Fix the value of default-directory upon startup on MS-Windows
* src/w32.c (w32_get_current_directory): New function.
(GetCachedVolumeInformation, init_environment): Use it.
(w32_init_current_directory): New function.
* src/w32.h (w32_init_current_directory): Add prototype.
* src/emacs.c (main) [WINDOWSNT]: Use w32_init_current_directory
to get the accurate value of cwd. This is needed to record
the correct directory in emacs_wd, which is now initialized
way earlier in the startup process, when init_environment was
not yet called. For details, see the problems reported in
http://lists.gnu.org/archive/html/emacs-devel/2018-12/msg00068.html.
Reported by Angelo Graziosi <angelo.g0@libero.it>.
Diffstat (limited to 'src/emacs.c')
| -rw-r--r-- | src/emacs.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/src/emacs.c b/src/emacs.c index acb4959bfea..eddd729f0a4 100644 --- a/src/emacs.c +++ b/src/emacs.c @@ -736,6 +736,8 @@ main (int argc, char **argv) /* Initialize the codepage for file names, needed to decode non-ASCII file names during startup. */ w32_init_file_name_codepage (); + /* Initialize the startup directory, needed for emacs_wd below. */ + w32_init_current_directory (); #endif w32_init_main_thread (); #endif @@ -816,6 +818,10 @@ main (int argc, char **argv) exit (1); } original_pwd = emacs_wd; +#ifdef WINDOWSNT + /* Reinitialize Emacs's notion of the startup directory. */ + w32_init_current_directory (); +#endif emacs_wd = emacs_get_current_dir_name (); } |
