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. */
42
42
#include "internal.h"
43
43
44
44
#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
45
66
#define getexecname () NULL
46
67
#endif
68
+ #endif
47
69
48
70
/* Initialize the fileline information from the executable. Returns 1
49
71
on success, 0 on failure. */
You can’t perform that action at this time.
0 commit comments