Skip to content

Commit

Permalink
mingw/msvc: use the new-style RUNTIME_PREFIX helper
Browse files Browse the repository at this point in the history
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 <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
  • Loading branch information
dscho committed May 24, 2018
1 parent 0f82c51 commit 0c5001d
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
5 changes: 2 additions & 3 deletions compat/mingw.c
Original file line number Diff line number Diff line change
Expand Up @@ -3453,7 +3453,7 @@ void mingw_startup(void)
die_startup();

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

/* convert command line arguments and environment to UTF-8 */
__argv[0] = wcstoutfdup_startup(buffer, _wpgmptr, maxlen);
for (i = 1; i < argc; i++)
for (i = 0; i < argc; i++)
__argv[i] = wcstoutfdup_startup(buffer, wargv[i], maxlen);
for (i = 0; wenv[i]; i++)
environ[i] = wcstoutfdup_startup(buffer, wenv[i], maxlen);
Expand Down
2 changes: 2 additions & 0 deletions config.mak.uname
Original file line number Diff line number Diff line change
Expand Up @@ -395,6 +395,7 @@ ifeq ($(uname_S),Windows)
# SNPRINTF_RETURNS_BOGUS = YesPlease
NO_SVN_TESTS = YesPlease
RUNTIME_PREFIX = YesPlease
HAVE_WPGMPTR = YesWeDo
NO_ST_BLOCKS_IN_STRUCT_STAT = YesPlease
USE_WIN32_MMAP = YesPlease
MMAP_PREVENTS_DELETE = UnfortunatelyYes
Expand Down Expand Up @@ -563,6 +564,7 @@ ifneq (,$(findstring MINGW,$(uname_S)))
NO_MKDTEMP = YesPlease
NO_SVN_TESTS = YesPlease
RUNTIME_PREFIX = YesPlease
HAVE_WPGMPTR = YesWeDo
NO_ST_BLOCKS_IN_STRUCT_STAT = YesPlease
USE_WIN32_MMAP = YesPlease
MMAP_PREVENTS_DELETE = UnfortunatelyYes
Expand Down

0 comments on commit 0c5001d

Please sign in to comment.