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 @@ -51,8 +51,30 @@ POSSIBILITY OF SUCH DAMAGE. */
51
51
#include "internal.h"
52
52
53
53
#ifndef HAVE_GETEXECNAME
54
+ #if defined(__WIN32__ ) && !defined(__MSYS__ ) && !defined(__CYGWIN__ )
55
+ /*
56
+ * Windows-specific implementation of getexecname();
57
+ * MSYS/Cygwin want to fall back to /proc/self/exe instead.
58
+ */
59
+ #define WIN32_LEAN_AND_MEAN
60
+ #include <windows.h>
61
+
62
+ static inline const char * getexecname (void )
63
+ {
64
+ static char path [32768 ]; /* Allow for long paths, i.e. do not use MAX_PATH */
65
+
66
+ switch (GetModuleFileNameA (NULL , path , sizeof (path ))) {
67
+ case 0 :
68
+ case sizeof (path ):
69
+ return NULL ;
70
+ }
71
+
72
+ return path ;
73
+ }
74
+ #else
54
75
#define getexecname () NULL
55
76
#endif
77
+ #endif
56
78
57
79
#if !defined (HAVE_KERN_PROC_ARGS ) && !defined (HAVE_KERN_PROC )
58
80
You can’t perform that action at this time.
0 commit comments