0.9.9.12:
[sbcl.git] / src / runtime / win32-os.c
index a867faf..8ec02db 100644 (file)
@@ -38,6 +38,7 @@
 #include "interrupt.h"
 #include "interr.h"
 #include "lispregs.h"
+#include "runtime.h"
 #include "monitor.h"
 #include "alloc.h"
 #include "genesis/primitive-objects.h"
@@ -635,4 +636,19 @@ void scratch(void)
     Sleep(0);
 }
 
+char *
+os_get_runtime_executable_path()
+{
+    char path[MAX_PATH + 1];
+    DWORD bufsize = sizeof(path);
+    DWORD size;
+
+    if ((size = GetModuleFileNameA(NULL, path, bufsize)) == 0)
+        return NULL;
+    else if (size == bufsize && GetLastError() == ERROR_INSUFFICIENT_BUFFER)
+        return NULL;
+
+    return copied_string(path);
+}
+
 /* EOF */