author | Johannes Sixt <johannes.sixt@telecom.at> | |
Mon, 21 Jul 2008 19:19:57 +0000 (21:19 +0200) | ||
committer | Junio C Hamano <gitster@pobox.com> | |
Sat, 26 Jul 2008 00:41:13 +0000 (17:41 -0700) | ||
commit | 35eeef47220c68c92d0f377f5678c42da2232c20 | |
tree | d778e47415f172e57daa700118336a925368a48a | tree | snapshot |
parent | bf74a88244c4fe631535b50ef090541dddf9029d | commit | diff |
Windows: Make sure argv[0] has a path
Since the exec-path on Windows is derived from the program invocation path,
we must ensure that argv[0] always has a path. Unfortunately, if a program
is invoked from CMD, argv[0] has no path. But on the other hand, the
C runtime offers a global variable, _pgmptr, that always has the full path
to the program. We hook into main() with a preprocessor macro, where we
replace argv[0].
Signed-off-by: Johannes Sixt <johannes.sixt@telecom.at>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Since the exec-path on Windows is derived from the program invocation path,
we must ensure that argv[0] always has a path. Unfortunately, if a program
is invoked from CMD, argv[0] has no path. But on the other hand, the
C runtime offers a global variable, _pgmptr, that always has the full path
to the program. We hook into main() with a preprocessor macro, where we
replace argv[0].
Signed-off-by: Johannes Sixt <johannes.sixt@telecom.at>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
compat/mingw.h | diff | blob | history |