diff options
| -rw-r--r-- | src/fileio.c | 23 |
1 files changed, 12 insertions, 11 deletions
diff --git a/src/fileio.c b/src/fileio.c index fa7b51d7e9d..0f9eab17e7f 100644 --- a/src/fileio.c +++ b/src/fileio.c | |||
| @@ -794,7 +794,7 @@ file names in the file system.\n\ | |||
| 794 | An initial `~/' expands to your home directory.\n\ | 794 | An initial `~/' expands to your home directory.\n\ |
| 795 | An initial `~USER/' expands to USER's home directory.\n\ | 795 | An initial `~USER/' expands to USER's home directory.\n\ |
| 796 | See also the function `substitute-in-file-name'.") | 796 | See also the function `substitute-in-file-name'.") |
| 797 | (name, default_directory) | 797 | (name, default_directory) |
| 798 | Lisp_Object name, default_directory; | 798 | Lisp_Object name, default_directory; |
| 799 | { | 799 | { |
| 800 | unsigned char *nm; | 800 | unsigned char *nm; |
| @@ -829,7 +829,8 @@ See also the function `substitute-in-file-name'.") | |||
| 829 | /* Use the buffer's default-directory if DEFAULT_DIRECTORY is omitted. */ | 829 | /* Use the buffer's default-directory if DEFAULT_DIRECTORY is omitted. */ |
| 830 | if (NILP (default_directory)) | 830 | if (NILP (default_directory)) |
| 831 | default_directory = current_buffer->directory; | 831 | default_directory = current_buffer->directory; |
| 832 | CHECK_STRING (default_directory, 1); | 832 | if (! STRINGP (default_directory)) |
| 833 | default_directory = build_string ("/"); | ||
| 833 | 834 | ||
| 834 | if (!NILP (default_directory)) | 835 | if (!NILP (default_directory)) |
| 835 | { | 836 | { |
| @@ -1242,7 +1243,7 @@ See also the function `substitute-in-file-name'.") | |||
| 1242 | } | 1243 | } |
| 1243 | 1244 | ||
| 1244 | /* Keep only a prefix from newdir if nm starts with slash | 1245 | /* Keep only a prefix from newdir if nm starts with slash |
| 1245 | (//server/share for UNC, nothing otherwise). */ | 1246 | (//server/share for UNC, nothing otherwise). */ |
| 1246 | if (IS_DIRECTORY_SEP (nm[0]) && collapse_newdir) | 1247 | if (IS_DIRECTORY_SEP (nm[0]) && collapse_newdir) |
| 1247 | { | 1248 | { |
| 1248 | #ifdef WINDOWSNT | 1249 | #ifdef WINDOWSNT |
| @@ -1265,7 +1266,7 @@ See also the function `substitute-in-file-name'.") | |||
| 1265 | if (newdir) | 1266 | if (newdir) |
| 1266 | { | 1267 | { |
| 1267 | /* Get rid of any slash at the end of newdir, unless newdir is | 1268 | /* Get rid of any slash at the end of newdir, unless newdir is |
| 1268 | just // (an incomplete UNC name). */ | 1269 | just // (an incomplete UNC name). */ |
| 1269 | length = strlen (newdir); | 1270 | length = strlen (newdir); |
| 1270 | if (length > 0 && IS_DIRECTORY_SEP (newdir[length - 1]) | 1271 | if (length > 0 && IS_DIRECTORY_SEP (newdir[length - 1]) |
| 1271 | #ifdef WINDOWSNT | 1272 | #ifdef WINDOWSNT |
| @@ -1369,7 +1370,7 @@ See also the function `substitute-in-file-name'.") | |||
| 1369 | else if (IS_DIRECTORY_SEP (p[0]) && IS_DIRECTORY_SEP (p[1]) | 1370 | else if (IS_DIRECTORY_SEP (p[0]) && IS_DIRECTORY_SEP (p[1]) |
| 1370 | #if defined (APOLLO) || defined (WINDOWSNT) | 1371 | #if defined (APOLLO) || defined (WINDOWSNT) |
| 1371 | /* // at start of filename is meaningful in Apollo | 1372 | /* // at start of filename is meaningful in Apollo |
| 1372 | and WindowsNT systems */ | 1373 | and WindowsNT systems. */ |
| 1373 | && o != target | 1374 | && o != target |
| 1374 | #endif /* APOLLO || WINDOWSNT */ | 1375 | #endif /* APOLLO || WINDOWSNT */ |
| 1375 | ) | 1376 | ) |
| @@ -1464,7 +1465,7 @@ See also the function `substitute-in-file-name'.") | |||
| 1464 | nm = XSTRING (name)->data; | 1465 | nm = XSTRING (name)->data; |
| 1465 | 1466 | ||
| 1466 | /* If nm is absolute, flush ...// and detect /./ and /../. | 1467 | /* If nm is absolute, flush ...// and detect /./ and /../. |
| 1467 | If no /./ or /../ we can return right away. */ | 1468 | If no /./ or /../ we can return right away. */ |
| 1468 | if ( | 1469 | if ( |
| 1469 | nm[0] == '/' | 1470 | nm[0] == '/' |
| 1470 | #ifdef VMS | 1471 | #ifdef VMS |
| @@ -1478,7 +1479,7 @@ See also the function `substitute-in-file-name'.") | |||
| 1478 | { | 1479 | { |
| 1479 | if (p[0] == '/' && p[1] == '/' | 1480 | if (p[0] == '/' && p[1] == '/' |
| 1480 | #ifdef APOLLO | 1481 | #ifdef APOLLO |
| 1481 | /* // at start of filename is meaningful on Apollo system */ | 1482 | /* // at start of filename is meaningful on Apollo system. */ |
| 1482 | && nm != p | 1483 | && nm != p |
| 1483 | #endif /* APOLLO */ | 1484 | #endif /* APOLLO */ |
| 1484 | ) | 1485 | ) |
| @@ -1711,7 +1712,7 @@ See also the function `substitute-in-file-name'.") | |||
| 1711 | } | 1712 | } |
| 1712 | else if (!strncmp (p, "//", 2) | 1713 | else if (!strncmp (p, "//", 2) |
| 1713 | #ifdef APOLLO | 1714 | #ifdef APOLLO |
| 1714 | /* // at start of filename is meaningful in Apollo system */ | 1715 | /* // at start of filename is meaningful in Apollo system. */ |
| 1715 | && o != target | 1716 | && o != target |
| 1716 | #endif /* APOLLO */ | 1717 | #endif /* APOLLO */ |
| 1717 | ) | 1718 | ) |
| @@ -1787,14 +1788,14 @@ duplicates what `expand-file-name' does.") | |||
| 1787 | #endif | 1788 | #endif |
| 1788 | endp = nm + XSTRING (filename)->size; | 1789 | endp = nm + XSTRING (filename)->size; |
| 1789 | 1790 | ||
| 1790 | /* If /~ or // appears, discard everything through first slash. */ | 1791 | /* If /~ or // appears, discard everything through first slash. */ |
| 1791 | 1792 | ||
| 1792 | for (p = nm; p != endp; p++) | 1793 | for (p = nm; p != endp; p++) |
| 1793 | { | 1794 | { |
| 1794 | if ((p[0] == '~' | 1795 | if ((p[0] == '~' |
| 1795 | #if defined (APOLLO) || defined (WINDOWSNT) | 1796 | #if defined (APOLLO) || defined (WINDOWSNT) |
| 1796 | /* // at start of file name is meaningful in Apollo and | 1797 | /* // at start of file name is meaningful in Apollo and |
| 1797 | WindowsNT systems */ | 1798 | WindowsNT systems. */ |
| 1798 | || (IS_DIRECTORY_SEP (p[0]) && p - 1 != nm) | 1799 | || (IS_DIRECTORY_SEP (p[0]) && p - 1 != nm) |
| 1799 | #else /* not (APOLLO || WINDOWSNT) */ | 1800 | #else /* not (APOLLO || WINDOWSNT) */ |
| 1800 | || IS_DIRECTORY_SEP (p[0]) | 1801 | || IS_DIRECTORY_SEP (p[0]) |
| @@ -1928,7 +1929,7 @@ duplicates what `expand-file-name' does.") | |||
| 1928 | 1929 | ||
| 1929 | *x = 0; | 1930 | *x = 0; |
| 1930 | 1931 | ||
| 1931 | /* If /~ or // appears, discard everything through first slash. */ | 1932 | /* If /~ or // appears, discard everything through first slash. */ |
| 1932 | 1933 | ||
| 1933 | for (p = xnm; p != x; p++) | 1934 | for (p = xnm; p != x; p++) |
| 1934 | if ((p[0] == '~' | 1935 | if ((p[0] == '~' |