File tree Expand file tree Collapse file tree 1 file changed +22
-0
lines changed Expand file tree Collapse file tree 1 file changed +22
-0
lines changed Original file line number Diff line number Diff line change @@ -42,8 +42,30 @@ POSSIBILITY OF SUCH DAMAGE. */
4242#include "internal.h"
4343
4444#ifndef HAVE_GETEXECNAME
45+ #if defined(__WIN32__ ) && !defined(__MSYS__ ) && !defined(__CYGWIN__ )
46+ /*
47+ * Windows-specific implementation of getexecname();
48+ * MSYS/Cygwin want to fall back to /proc/self/exe instead.
49+ */
50+ #define WIN32_LEAN_AND_MEAN
51+ #include <windows.h>
52+
53+ static inline const char * getexecname (void )
54+ {
55+ static char path [32768 ]; /* Allow for long paths, i.e. do not use MAX_PATH */
56+
57+ switch (GetModuleFileNameA (NULL , path , sizeof (path ))) {
58+ case 0 :
59+ case sizeof (path ):
60+ return NULL ;
61+ }
62+
63+ return path ;
64+ }
65+ #else
4566#define getexecname () NULL
4667#endif
68+ #endif
4769
4870/* Initialize the fileline information from the executable. Returns 1
4971 on success, 0 on failure. */
You can’t perform that action at this time.
0 commit comments