diff options
| author | Juanma Barranquero | 2010-06-04 16:13:35 +0200 |
|---|---|---|
| committer | Juanma Barranquero | 2010-06-04 16:13:35 +0200 |
| commit | 087fc47ace7797d2ef36ff167f7befd5f4ba01da (patch) | |
| tree | 0ed8bed24cd9249672b0afaa79caeea8e4ca6dcc /src/fileio.c | |
| parent | 4f201088d33976f3ce04d7e01d1fbd4b6044cbe0 (diff) | |
| download | emacs-087fc47ace7797d2ef36ff167f7befd5f4ba01da.tar.gz emacs-087fc47ace7797d2ef36ff167f7befd5f4ba01da.zip | |
Turn `directory-sep-char' into a noop.
* lisp/subr.el (directory-sep-char): Move from fileio.c and make a defconst.
* src/emacs.c (decode_env_path): Don't check DIRECTORY_SEP,
call dostounix_filename directly.
* src/fileio.c (CORRECT_DIR_SEPS): Remove.
(Ffile_name_directory, directory_file_name, Fexpand_file_name)
(Fsubstitute_in_file_name): Use dostounix_filename instead.
(file_name_as_directory): Use dostounix_filename, DIRECTORY_SEP.
(syms_of_fileio) <directory-sep-char>: Move to subr.el.
* src/lisp.h [WINDOWSNT] (Vdirectory_sep_char): Don't declare.
(DIRECTORY_SEP): Define unconditionally.
* src/w32proc.c (CORRECT_DIR_SEPS): Remove.
(Fw32_short_file_name, Fw32_long_file_name): Use dostounix_filename.
* src/s/ms-w32.h (DIRECTORY_SEP): Remove.
Diffstat (limited to 'src/fileio.c')
| -rw-r--r-- | src/fileio.c | 29 |
1 files changed, 9 insertions, 20 deletions
diff --git a/src/fileio.c b/src/fileio.c index dc5ca37ff2f..8c2ee45c073 100644 --- a/src/fileio.c +++ b/src/fileio.c | |||
| @@ -83,10 +83,6 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ | |||
| 83 | #endif | 83 | #endif |
| 84 | 84 | ||
| 85 | #ifdef DOS_NT | 85 | #ifdef DOS_NT |
| 86 | #define CORRECT_DIR_SEPS(s) \ | ||
| 87 | do { if ('/' == DIRECTORY_SEP) dostounix_filename (s); \ | ||
| 88 | else unixtodos_filename (s); \ | ||
| 89 | } while (0) | ||
| 90 | /* On Windows, drive letters must be alphabetic - on DOS, the Netware | 86 | /* On Windows, drive letters must be alphabetic - on DOS, the Netware |
| 91 | redirector allows the six letters between 'Z' and 'a' as well. */ | 87 | redirector allows the six letters between 'Z' and 'a' as well. */ |
| 92 | #ifdef MSDOS | 88 | #ifdef MSDOS |
| @@ -474,7 +470,7 @@ Given a Unix syntax file name, returns a string ending in slash. */) | |||
| 474 | p = beg + strlen (beg); | 470 | p = beg + strlen (beg); |
| 475 | } | 471 | } |
| 476 | } | 472 | } |
| 477 | CORRECT_DIR_SEPS (beg); | 473 | dostounix_filename (beg); |
| 478 | #endif /* DOS_NT */ | 474 | #endif /* DOS_NT */ |
| 479 | 475 | ||
| 480 | return make_specified_string (beg, -1, p - beg, STRING_MULTIBYTE (filename)); | 476 | return make_specified_string (beg, -1, p - beg, STRING_MULTIBYTE (filename)); |
| @@ -561,12 +557,11 @@ file_name_as_directory (out, in) | |||
| 561 | /* For Unix syntax, Append a slash if necessary */ | 557 | /* For Unix syntax, Append a slash if necessary */ |
| 562 | if (!IS_DIRECTORY_SEP (out[size])) | 558 | if (!IS_DIRECTORY_SEP (out[size])) |
| 563 | { | 559 | { |
| 564 | /* Cannot use DIRECTORY_SEP, which could have any value */ | 560 | out[size + 1] = DIRECTORY_SEP; |
| 565 | out[size + 1] = '/'; | ||
| 566 | out[size + 2] = '\0'; | 561 | out[size + 2] = '\0'; |
| 567 | } | 562 | } |
| 568 | #ifdef DOS_NT | 563 | #ifdef DOS_NT |
| 569 | CORRECT_DIR_SEPS (out); | 564 | dostounix_filename (out); |
| 570 | #endif | 565 | #endif |
| 571 | return out; | 566 | return out; |
| 572 | } | 567 | } |
| @@ -627,7 +622,7 @@ directory_file_name (src, dst) | |||
| 627 | ) | 622 | ) |
| 628 | dst[slen - 1] = 0; | 623 | dst[slen - 1] = 0; |
| 629 | #ifdef DOS_NT | 624 | #ifdef DOS_NT |
| 630 | CORRECT_DIR_SEPS (dst); | 625 | dostounix_filename (dst); |
| 631 | #endif | 626 | #endif |
| 632 | return 1; | 627 | return 1; |
| 633 | } | 628 | } |
| @@ -1032,10 +1027,9 @@ filesystem tree, not (expand-file-name ".." dirname). */) | |||
| 1032 | if (!lose) | 1027 | if (!lose) |
| 1033 | { | 1028 | { |
| 1034 | #ifdef DOS_NT | 1029 | #ifdef DOS_NT |
| 1035 | /* Make sure directories are all separated with / or \ as | 1030 | /* Make sure directories are all separated with /, but |
| 1036 | desired, but avoid allocation of a new string when not | 1031 | avoid allocation of a new string when not required. */ |
| 1037 | required. */ | 1032 | dostounix_filename (nm); |
| 1038 | CORRECT_DIR_SEPS (nm); | ||
| 1039 | #ifdef WINDOWSNT | 1033 | #ifdef WINDOWSNT |
| 1040 | if (IS_DIRECTORY_SEP (nm[1])) | 1034 | if (IS_DIRECTORY_SEP (nm[1])) |
| 1041 | { | 1035 | { |
| @@ -1381,7 +1375,7 @@ filesystem tree, not (expand-file-name ".." dirname). */) | |||
| 1381 | target[0] = '/'; | 1375 | target[0] = '/'; |
| 1382 | target[1] = ':'; | 1376 | target[1] = ':'; |
| 1383 | } | 1377 | } |
| 1384 | CORRECT_DIR_SEPS (target); | 1378 | dostounix_filename (target); |
| 1385 | #endif /* DOS_NT */ | 1379 | #endif /* DOS_NT */ |
| 1386 | 1380 | ||
| 1387 | result = make_specified_string (target, -1, o - target, multibyte); | 1381 | result = make_specified_string (target, -1, o - target, multibyte); |
| @@ -1659,7 +1653,7 @@ those `/' is discarded. */) | |||
| 1659 | bcopy (SDATA (filename), nm, SBYTES (filename) + 1); | 1653 | bcopy (SDATA (filename), nm, SBYTES (filename) + 1); |
| 1660 | 1654 | ||
| 1661 | #ifdef DOS_NT | 1655 | #ifdef DOS_NT |
| 1662 | CORRECT_DIR_SEPS (nm); | 1656 | dostounix_filename (nm); |
| 1663 | substituted = (strcmp (nm, SDATA (filename)) != 0); | 1657 | substituted = (strcmp (nm, SDATA (filename)) != 0); |
| 1664 | #endif | 1658 | #endif |
| 1665 | endp = nm + SBYTES (filename); | 1659 | endp = nm + SBYTES (filename); |
| @@ -5787,11 +5781,6 @@ of file names regardless of the current language environment. */); | |||
| 5787 | Fput (Qfile_date_error, Qerror_message, | 5781 | Fput (Qfile_date_error, Qerror_message, |
| 5788 | make_pure_c_string ("Cannot set file date")); | 5782 | make_pure_c_string ("Cannot set file date")); |
| 5789 | 5783 | ||
| 5790 | DEFVAR_LISP ("directory-sep-char", &Vdirectory_sep_char, | ||
| 5791 | doc: /* Directory separator character for built-in functions that return file names. | ||
| 5792 | The value is always ?/. Don't use this variable, just use `/'. */); | ||
| 5793 | XSETFASTINT (Vdirectory_sep_char, '/'); | ||
| 5794 | |||
| 5795 | DEFVAR_LISP ("file-name-handler-alist", &Vfile_name_handler_alist, | 5784 | DEFVAR_LISP ("file-name-handler-alist", &Vfile_name_handler_alist, |
| 5796 | doc: /* *Alist of elements (REGEXP . HANDLER) for file names handled specially. | 5785 | doc: /* *Alist of elements (REGEXP . HANDLER) for file names handled specially. |
| 5797 | If a file name matches REGEXP, then all I/O on that file is done by calling | 5786 | If a file name matches REGEXP, then all I/O on that file is done by calling |