diff options
| author | Eli Zaretskii | 2018-12-12 18:27:05 +0200 |
|---|---|---|
| committer | Eli Zaretskii | 2018-12-12 18:27:05 +0200 |
| commit | 6e76e11c4200a4d4185e0b7d6cea5164d459737b (patch) | |
| tree | 7a96134416ee2d6ae1733e8333c1a8e08aadb690 /src | |
| parent | 8c28ac8023cee235885ab0f44b73dbfef6f0a10d (diff) | |
| download | emacs-6e76e11c4200a4d4185e0b7d6cea5164d459737b.tar.gz emacs-6e76e11c4200a4d4185e0b7d6cea5164d459737b.zip | |
Fix regression in expand-file-name with drive-relative HOME
* src/fileio.c (get_homedir) [DOS_NT]: Expand drive-relative
$HOME to begin with "X:/".
* test/src/fileio-tests.el (fileio-tests--relative-HOME): Add
testing of drive-relative value of $HOME on MS-Windows and
MS-DOS.
Diffstat (limited to 'src')
| -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) | |||
| 1692 | if (!home) | 1692 | if (!home) |
| 1693 | return ""; | 1693 | return ""; |
| 1694 | } | 1694 | } |
| 1695 | #ifdef DOS_NT | ||
| 1696 | /* If home is a drive-relative directory, expand it. */ | ||
| 1697 | if (IS_DRIVE (*home) | ||
| 1698 | && IS_DEVICE_SEP (home[1]) | ||
| 1699 | && !IS_DIRECTORY_SEP (home[2])) | ||
| 1700 | { | ||
| 1701 | # ifdef WINDOWSNT | ||
| 1702 | static char hdir[MAX_UTF8_PATH]; | ||
| 1703 | # else | ||
| 1704 | static char hdir[MAXPATHLEN]; | ||
| 1705 | # endif | ||
| 1706 | if (!getdefdir (c_toupper (*home) - 'A' + 1, hdir)) | ||
| 1707 | { | ||
| 1708 | hdir[0] = c_toupper (*home); | ||
| 1709 | hdir[1] = ':'; | ||
| 1710 | hdir[2] = '/'; | ||
| 1711 | hdir[3] = '\0'; | ||
| 1712 | } | ||
| 1713 | if (home[2]) | ||
| 1714 | { | ||
| 1715 | size_t homelen = strlen (hdir); | ||
| 1716 | if (!IS_DIRECTORY_SEP (hdir[homelen - 1])) | ||
| 1717 | strcat (hdir, "/"); | ||
| 1718 | strcat (hdir, home + 2); | ||
| 1719 | } | ||
| 1720 | home = hdir; | ||
| 1721 | } | ||
| 1722 | #endif | ||
| 1695 | if (IS_ABSOLUTE_FILE_NAME (home)) | 1723 | if (IS_ABSOLUTE_FILE_NAME (home)) |
| 1696 | return home; | 1724 | return home; |
| 1697 | if (!emacs_wd) | 1725 | if (!emacs_wd) |