1
Fork 0
mirror of git://git.sv.gnu.org/emacs.git synced 2026-01-17 00:30:37 -08:00

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.
This commit is contained in:
Eli Zaretskii 2018-11-13 22:01:57 +02:00
parent 1b27c4890d
commit 4a5a17507f

View file

@ -1096,18 +1096,7 @@ the root directory. */)
newdir = get_homedir ();
nm++;
#ifdef WINDOWSNT
if (newdir[0])
{
char newdir_utf8[MAX_UTF8_PATH];
filename_from_ansi (newdir, newdir_utf8);
tem = make_unibyte_string (newdir_utf8, strlen (newdir_utf8));
newdir = SSDATA (tem);
}
else
#endif
tem = build_string (newdir);
tem = build_string (newdir);
newdirlim = newdir + SBYTES (tem);
/* get_homedir may return a unibyte string, which will bite us
if we expect the directory to be multibyte. */
@ -1669,6 +1658,19 @@ char const *
get_homedir (void)
{
char const *home = egetenv ("HOME");
#ifdef WINDOWSNT
/* getpw* functions return UTF-8 encoded file names, whereas egetenv
returns strings in locale encoding, so we need to convert for
consistency. */
char homedir_utf8[MAX_UTF8_PATH];
if (home)
{
filename_from_ansi (home, homedir_utf8);
home = homedir_utf8;
}
#endif
if (!home)
{
static char const *userenv[] = {"LOGNAME", "USER"};