diff options
author | Stephen Leake <stephen_leake@stephe-leake.org> | 2018-12-13 14:39:02 -0800 |
---|---|---|
committer | Stephen Leake <stephen_leake@stephe-leake.org> | 2018-12-13 14:39:02 -0800 |
commit | 87bef630bf0f45e8da74e43ba614aa2292b296ef (patch) | |
tree | efdead3c0d7dd227bacbd4dfc5c1ff9b4d5c13c3 /src/fileio.c | |
parent | 4d3f7b77cc7dea072d2ecb9f137c2e497bc52da1 (diff) | |
parent | d08b75abe0f0cf9ade812b189c374809a2c7836e (diff) | |
download | emacs-87bef630bf0f45e8da74e43ba614aa2292b296ef.tar.gz |
Merge commit 'd08b75abe0f0cf9ade812b189c374809a2c7836e'
Diffstat (limited to 'src/fileio.c')
-rw-r--r-- | src/fileio.c | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/src/fileio.c b/src/fileio.c index d9795715f9e..687f6ec7452 100644 --- a/src/fileio.c +++ b/src/fileio.c @@ -1692,6 +1692,34 @@ get_homedir (void) if (!home) return ""; } +#ifdef DOS_NT + /* If home is a drive-relative directory, expand it. */ + if (IS_DRIVE (*home) + && IS_DEVICE_SEP (home[1]) + && !IS_DIRECTORY_SEP (home[2])) + { +# ifdef WINDOWSNT + static char hdir[MAX_UTF8_PATH]; +# else + static char hdir[MAXPATHLEN]; +# endif + if (!getdefdir (c_toupper (*home) - 'A' + 1, hdir)) + { + hdir[0] = c_toupper (*home); + hdir[1] = ':'; + hdir[2] = '/'; + hdir[3] = '\0'; + } + if (home[2]) + { + size_t homelen = strlen (hdir); + if (!IS_DIRECTORY_SEP (hdir[homelen - 1])) + strcat (hdir, "/"); + strcat (hdir, home + 2); + } + home = hdir; + } +#endif if (IS_ABSOLUTE_FILE_NAME (home)) return home; if (!emacs_wd) |