Mercurial > emacs
comparison src/fileio.c @ 4451:73b91cd2c55e
(expand_and_dir_to_file): Remove final / by copying abspath.
author | Richard M. Stallman <rms@gnu.org> |
---|---|
date | Wed, 04 Aug 1993 22:51:22 +0000 |
parents | 76b24be40a57 |
children | 6894dd27c9ec |
comparison
equal
deleted
inserted
replaced
4450:325bc5407213 | 4451:73b91cd2c55e |
---|---|
1504 /* NOTREACHED */ | 1504 /* NOTREACHED */ |
1505 #endif /* not VMS */ | 1505 #endif /* not VMS */ |
1506 } | 1506 } |
1507 | 1507 |
1508 /* A slightly faster and more convenient way to get | 1508 /* A slightly faster and more convenient way to get |
1509 (directory-file-name (expand-file-name FOO)). The return value may | 1509 (directory-file-name (expand-file-name FOO)). */ |
1510 have had its last character zapped with a '\0' character, meaning | |
1511 that it is acceptable to system calls, but not to other lisp | |
1512 functions. Callers should make sure that the return value doesn't | |
1513 escape. */ | |
1514 | 1510 |
1515 Lisp_Object | 1511 Lisp_Object |
1516 expand_and_dir_to_file (filename, defdir) | 1512 expand_and_dir_to_file (filename, defdir) |
1517 Lisp_Object filename, defdir; | 1513 Lisp_Object filename, defdir; |
1518 { | 1514 { |
1528 #else | 1524 #else |
1529 /* Remove final slash, if any (unless path is root). | 1525 /* Remove final slash, if any (unless path is root). |
1530 stat behaves differently depending! */ | 1526 stat behaves differently depending! */ |
1531 if (XSTRING (abspath)->size > 1 | 1527 if (XSTRING (abspath)->size > 1 |
1532 && XSTRING (abspath)->data[XSTRING (abspath)->size - 1] == '/') | 1528 && XSTRING (abspath)->data[XSTRING (abspath)->size - 1] == '/') |
1533 { | 1529 abspath = Fsubstring (abspath, make_number (0), |
1534 if (EQ (abspath, filename)) | 1530 make_number (XSTRING (abspath)->size - 1)); |
1535 abspath = Fcopy_sequence (abspath); | |
1536 XSTRING (abspath)->data[XSTRING (abspath)->size - 1] = 0; | |
1537 } | |
1538 #endif | 1531 #endif |
1539 return abspath; | 1532 return abspath; |
1540 } | 1533 } |
1541 | 1534 |
1542 barf_or_query_if_file_exists (absname, querystring, interactive) | 1535 barf_or_query_if_file_exists (absname, querystring, interactive) |