Skip to content

Commit 6e007ce

Browse files
committed
mingw/msvc: use the new-style RUNTIME_PREFIX helper
This change also allows us to stop overriding argv[0] with the absolute path of the executable, allowing us to preserve e.g. the case of the executable's file name. This fixes #1496 partially. Signed-off-by: Johannes Schindelin <[email protected]> Signed-off-by: Junio C Hamano <[email protected]> Signed-off-by: Johannes Schindelin <[email protected]>
1 parent 0b6a950 commit 6e007ce

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

compat/mingw.c

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3454,7 +3454,7 @@ void mingw_startup(void)
34543454
die_startup();
34553455

34563456
/* determine size of argv and environ conversion buffer */
3457-
maxlen = wcslen(_wpgmptr);
3457+
maxlen = wcslen(wargv[0]);
34583458
for (i = 1; i < argc; i++)
34593459
maxlen = max(maxlen, wcslen(wargv[i]));
34603460
for (i = 0; wenv[i]; i++)
@@ -3474,8 +3474,7 @@ void mingw_startup(void)
34743474
buffer = malloc_startup(maxlen);
34753475

34763476
/* convert command line arguments and environment to UTF-8 */
3477-
__argv[0] = wcstoutfdup_startup(buffer, _wpgmptr, maxlen);
3478-
for (i = 1; i < argc; i++)
3477+
for (i = 0; i < argc; i++)
34793478
__argv[i] = wcstoutfdup_startup(buffer, wargv[i], maxlen);
34803479
for (i = 0; wenv[i]; i++)
34813480
environ[i] = wcstoutfdup_startup(buffer, wenv[i], maxlen);

config.mak.uname

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -395,6 +395,7 @@ ifeq ($(uname_S),Windows)
395395
# SNPRINTF_RETURNS_BOGUS = YesPlease
396396
NO_SVN_TESTS = YesPlease
397397
RUNTIME_PREFIX = YesPlease
398+
HAVE_WPGMPTR = YesWeDo
398399
NO_ST_BLOCKS_IN_STRUCT_STAT = YesPlease
399400
USE_WIN32_MMAP = YesPlease
400401
MMAP_PREVENTS_DELETE = UnfortunatelyYes
@@ -563,6 +564,7 @@ ifneq (,$(findstring MINGW,$(uname_S)))
563564
NO_MKDTEMP = YesPlease
564565
NO_SVN_TESTS = YesPlease
565566
RUNTIME_PREFIX = YesPlease
567+
HAVE_WPGMPTR = YesWeDo
566568
NO_ST_BLOCKS_IN_STRUCT_STAT = YesPlease
567569
USE_WIN32_MMAP = YesPlease
568570
MMAP_PREVENTS_DELETE = UnfortunatelyYes

0 commit comments

Comments
 (0)