[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
feature/native-comp e5a0d4c: Avoid aborting on MS-Windows at startup
From: |
Eli Zaretskii |
Subject: |
feature/native-comp e5a0d4c: Avoid aborting on MS-Windows at startup |
Date: |
Wed, 3 Mar 2021 12:59:33 -0500 (EST) |
branch: feature/native-comp
commit e5a0d4c42583fe38e38ab7782b8928ca54f82fad
Author: Eli Zaretskii <eliz@gnu.org>
Commit: Eli Zaretskii <eliz@gnu.org>
Avoid aborting on MS-Windows at startup
* src/emacs.c (set_invocation_vars) [WINDOWSNT]: If argv0 is not
an absolute file name, obtain the absolute file name of the Emacs
executable from 'w32_my_exename'.
---
src/emacs.c | 12 ++++++++++++
1 file changed, 12 insertions(+)
diff --git a/src/emacs.c b/src/emacs.c
index d541b41..ec62c19 100644
--- a/src/emacs.c
+++ b/src/emacs.c
@@ -37,6 +37,7 @@ along with GNU Emacs. If not, see
<https://www.gnu.org/licenses/>. */
#include <fcntl.h>
#include <sys/socket.h>
#include <mbstring.h>
+#include <filename.h> /* for IS_ABSOLUTE_FILE_NAME */
#include "w32.h"
#include "w32heap.h"
#endif
@@ -433,6 +434,12 @@ set_invocation_vars (char *argv0, char const *original_pwd)
{
char argv0_1[MAX_UTF8_PATH];
+ /* Avoid calling 'openp' below, as we aren't ready for that yet:
+ emacs_dir is not yet defined in the environment, and therefore
+ emacs_root_dir, called by expand-file-name, will abort. */
+ if (!IS_ABSOLUTE_FILE_NAME (argv0))
+ argv0 = w32_my_exename ();
+
if (filename_from_ansi (argv0, argv0_1) == 0)
raw_name = build_unibyte_string (argv0_1);
else
@@ -451,6 +458,11 @@ set_invocation_vars (char *argv0, char const *original_pwd)
Vinvocation_name = Ffile_name_nondirectory (raw_name);
Vinvocation_directory = Ffile_name_directory (raw_name);
+#ifdef WINDOWSNT
+ eassert (!NILP (Vinvocation_directory)
+ && !NILP (Ffile_name_absolute_p (Vinvocation_directory)));
+#endif
+
/* If we got no directory in argv0, search PATH to find where
Emacs actually came from. */
if (NILP (Vinvocation_directory))
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- feature/native-comp e5a0d4c: Avoid aborting on MS-Windows at startup,
Eli Zaretskii <=