summaryrefslogtreecommitdiff
path: root/src/emacs.c
diff options
context:
space:
mode:
authorEli Zaretskii <eliz@gnu.org>2013-11-02 15:03:32 +0200
committerEli Zaretskii <eliz@gnu.org>2013-11-02 15:03:32 +0200
commit1fd201bb1d720d0c5ab727a3972363778eef834f (patch)
tree508abf22dbb91d24309869bc42a93e814f9fbcd6 /src/emacs.c
parent5c4a19a90f803ed46629c2bdc1ac3d3563caa738 (diff)
downloademacs-1fd201bb1d720d0c5ab727a3972363778eef834f.tar.gz
Adapted dostounix_filename. w32-short/long-filename work with wide APIs.
Diffstat (limited to 'src/emacs.c')
-rw-r--r--src/emacs.c19
1 files changed, 16 insertions, 3 deletions
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