Skip to content

Commit 8d86b47

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 a9add53 commit 8d86b47

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
@@ -3453,7 +3453,7 @@ void mingw_startup(void)
34533453
die_startup();
34543454

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

34753475
/* convert command line arguments and environment to UTF-8 */
3476-
__argv[0] = wcstoutfdup_startup(buffer, _wpgmptr, maxlen);
3477-
for (i = 1; i < argc; i++)
3476+
for (i = 0; i < argc; i++)
34783477
__argv[i] = wcstoutfdup_startup(buffer, wargv[i], maxlen);
34793478
for (i = 0; wenv[i]; i++)
34803479
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)