aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEli Zaretskii2018-11-13 22:01:57 +0200
committerEli Zaretskii2018-11-13 22:01:57 +0200
commit4a5a17507fe1e12ee02c174350edc479fb01ac01 (patch)
treec0cafd8aaf5460c83161ff97aa45e115e1260966
parent1b27c4890d68882ef27eabe9984b6f5cfcc1b265 (diff)
downloademacs-4a5a17507fe1e12ee02c174350edc479fb01ac01.tar.gz
emacs-4a5a17507fe1e12ee02c174350edc479fb01ac01.zip
Fix recent change in fileio.c
* src/fileio.c (get_homedir) [WINDOWSNT]: Convert $HOME to UTF-8. (Fexpand_file_name): Don't convert it here.
-rw-r--r--src/fileio.c26
1 files changed, 14 insertions, 12 deletions
diff --git a/src/fileio.c b/src/fileio.c
index e178c39fc18..59446ac1833 100644
--- a/src/fileio.c
+++ b/src/fileio.c
@@ -1096,18 +1096,7 @@ the root directory. */)
1096 1096
1097 newdir = get_homedir (); 1097 newdir = get_homedir ();
1098 nm++; 1098 nm++;
1099#ifdef WINDOWSNT 1099 tem = build_string (newdir);
1100 if (newdir[0])
1101 {
1102 char newdir_utf8[MAX_UTF8_PATH];
1103
1104 filename_from_ansi (newdir, newdir_utf8);
1105 tem = make_unibyte_string (newdir_utf8, strlen (newdir_utf8));
1106 newdir = SSDATA (tem);
1107 }
1108 else
1109#endif
1110 tem = build_string (newdir);
1111 newdirlim = newdir + SBYTES (tem); 1100 newdirlim = newdir + SBYTES (tem);
1112 /* get_homedir may return a unibyte string, which will bite us 1101 /* get_homedir may return a unibyte string, which will bite us
1113 if we expect the directory to be multibyte. */ 1102 if we expect the directory to be multibyte. */
@@ -1669,6 +1658,19 @@ char const *
1669get_homedir (void) 1658get_homedir (void)
1670{ 1659{
1671 char const *home = egetenv ("HOME"); 1660 char const *home = egetenv ("HOME");
1661
1662#ifdef WINDOWSNT
1663 /* getpw* functions return UTF-8 encoded file names, whereas egetenv
1664 returns strings in locale encoding, so we need to convert for
1665 consistency. */
1666 char homedir_utf8[MAX_UTF8_PATH];
1667 if (home)
1668 {
1669 filename_from_ansi (home, homedir_utf8);
1670 home = homedir_utf8;
1671 }
1672#endif
1673
1672 if (!home) 1674 if (!home)
1673 { 1675 {
1674 static char const *userenv[] = {"LOGNAME", "USER"}; 1676 static char const *userenv[] = {"LOGNAME", "USER"};