From 1fd201bb1d720d0c5ab727a3972363778eef834f Mon Sep 17 00:00:00 2001 From: Eli Zaretskii Date: Sat, 2 Nov 2013 15:03:32 +0200 Subject: Adapted dostounix_filename. w32-short/long-filename work with wide APIs. --- src/emacs.c | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) (limited to 'src/emacs.c') diff --git a/src/emacs.c b/src/emacs.c index 06b8d290cae..a58829e8918 100644 --- a/src/emacs.c +++ b/src/emacs.c @@ -2153,9 +2153,15 @@ decode_env_path (const char *evarname, const char *defalt) Lisp_Object lpath, element, tem; #ifdef WINDOWSNT bool defaulted = 0; - const char *emacs_dir = egetenv ("emacs_dir"); static const char *emacs_dir_env = "%emacs_dir%/"; const size_t emacs_dir_len = strlen (emacs_dir_env); + const char *edir = egetenv ("emacs_dir"); + char emacs_dir[MAX_UTF8_PATH]; + + /* egetenv looks in process-environment, which holds the variables + in their original system-locale encoding. We need emacs_dir to + be in UTF-8. */ + filename_from_ansi (edir, emacs_dir); #endif /* It's okay to use getenv here, because this function is only used @@ -2176,9 +2182,16 @@ decode_env_path (const char *evarname, const char *defalt) /* Ensure values from the environment use the proper directory separator. */ if (path) { - char *path_copy = alloca (strlen (path) + 1); + char *path_copy; + +#ifdef WINDOWSNT + path_copy = alloca (MAX_UTF8_PATH); + filename_from_ansi (path, path_copy); +#else /* MSDOS */ + path_copy = alloca (strlen (path) + 1); strcpy (path_copy, path); - dostounix_filename (path_copy, 0); +#endif + dostounix_filename (path_copy); path = path_copy; } #endif -- cgit v1.2.1