mirror of
git://git.sv.gnu.org/emacs.git
synced 2026-01-01 18:00:40 -08:00
Act like POSIX sh if $HOME is relative
POSIX says sh ~/foo should act like $HOME/foo even if $HOME is
relative, so be consistent with that (Bug#33255).
* admin/merge-gnulib (GNULIB_MODULES): Add dosname.
* src/buffer.c (init_buffer): Use emacs_wd to get
initial working directory with slash appended if needed.
(default-directory): Say it must be absolute.
* src/emacs.c (emacs_wd): New global variable.
(init_cmdargs): Dir arg is now char const *.
(main): Set emacs_wd.
* src/emacs.c (main) [NS_IMPL_COCOA]:
* src/fileio.c (Fexpand_file_name):
Use get_homedir instead of egetenv ("HOME").
* src/fileio.c: Include dosname.h, for IS_ABSOLUTE_FILE_NAME.
(splice_dir_file, get_homedir): New functions.
* src/xrdb.c (gethomedir): Remove. All callers changed
to use get_homedir and splice_dir_file.
* test/src/fileio-tests.el (fileio-tests--relative-HOME): New test.
This commit is contained in:
parent
ce1fb157e8
commit
900276502f
7 changed files with 103 additions and 74 deletions
|
|
@ -95,3 +95,11 @@ Also check that an encoding error can appear in a symlink."
|
|||
(should (equal (file-name-as-directory "d:/abc/") "d:/abc/"))
|
||||
(should (equal (file-name-as-directory "D:\\abc/") "d:/abc/"))
|
||||
(should (equal (file-name-as-directory "D:/abc//") "d:/abc//")))
|
||||
|
||||
(ert-deftest fileio-tests--relative-HOME ()
|
||||
"Test that expand-file-name works even when HOME is relative."
|
||||
(let ((old-home (getenv "HOME")))
|
||||
(setenv "HOME" "a/b/c")
|
||||
(should (equal (expand-file-name "~/foo")
|
||||
(expand-file-name "a/b/c/foo")))
|
||||
(setenv "HOME" old-home)))
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue