* emacs.c (main): Don't chdir to $HOME on Cocoa if --chdir was given.

Fixes: debbugs:18846
This commit is contained in:
Jan Djärv 2014-10-31 16:18:36 +01:00
parent eeeaca5cb5
commit 08f558056d
2 changed files with 9 additions and 4 deletions

View file

@ -1,3 +1,8 @@
2014-10-31 Jan Djärv <jan.h.d@swipnet.se>
* emacs.c (main): Don't chdir to $HOME on Cocoa if --chdir
was given (Bug#18846).
2014-10-30 Jan Djärv <jan.h.d@swipnet.se>
* nsterm.h (ns_set_doc_edited): Declare taking no args.

View file

@ -716,7 +716,7 @@ main (int argc, char **argv)
#ifdef DAEMON_MUST_EXEC
char dname_arg2[80];
#endif
char *ch_to_dir;
char *ch_to_dir = 0;
/* If we use --chdir, this records the original directory. */
char *original_pwd = 0;
@ -1240,19 +1240,19 @@ Using an Emacs configured with --with-x-toolkit=lucid does not have this problem
/* Started from GUI? */
/* FIXME: Do the right thing if getenv returns NULL, or if
chdir fails. */
if (! inhibit_window_system && ! isatty (0))
if (! inhibit_window_system && ! isatty (0) && ! ch_to_dir)
chdir (getenv ("HOME"));
if (skip_args < argc)
{
if (!strncmp (argv[skip_args], "-psn", 4))
{
skip_args += 1;
chdir (getenv ("HOME"));
if (! ch_to_dir) chdir (getenv ("HOME"));
}
else if (skip_args+1 < argc && !strncmp (argv[skip_args+1], "-psn", 4))
{
skip_args += 2;
chdir (getenv ("HOME"));
if (! ch_to_dir) chdir (getenv ("HOME"));
}
}
#endif /* COCOA */