summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--ChangeLog7
-rw-r--r--txr.c13
2 files changed, 17 insertions, 3 deletions
diff --git a/ChangeLog b/ChangeLog
index 1bfc552e..4af53990 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,12 @@
2014-06-10 Kaz Kylheku <kaz@kylheku.com>
+ * txr.c (get_self_path): Fix spelling of GetModuleFileName.
+ Add missing parentheses in expression.
+ (sysroot_init): On Windows, filter progpath to change
+ backslashes to forward slashes.
+
+2014-06-10 Kaz Kylheku <kaz@kylheku.com>
+
* parser.l (yylex_destroy): The FLEX_ version are prefixed with YY_
in old flexes too.
diff --git a/txr.c b/txr.c
index 4b96cc8a..22bc8c4d 100644
--- a/txr.c
+++ b/txr.c
@@ -51,6 +51,7 @@
#include "debug.h"
#include "syslog.h"
#include "eval.h"
+#include "regex.h"
#include "txr.h"
const wchli_t *version = wli("89");
@@ -179,12 +180,12 @@ static val get_self_path(void)
DWORD nchar;
SetLastError(0);
- nchar = GetModuleFilename(NULL, self, MAX_PATH);
+ nchar = GetModuleFileNameW(NULL, self, MAX_PATH);
if (nchar == 0 ||
(nchar == MAX_PATH &&
- (GetLastError() == ERROR_INSUFFICIENT_BUFFER) ||
- (self[MAX_PATH - 1] != 0)))
+ ((GetLastError() == ERROR_INSUFFICIENT_BUFFER) ||
+ (self[MAX_PATH - 1] != 0))))
return nil;
return string(self);
@@ -224,8 +225,14 @@ static val sysroot(val target)
static void sysroot_init(void)
{
+#if HAVE_WINDOWS_H
+ val slash = regex_compile(lit("\\\\"), nil);
+#endif
prot1(&progpath);
progpath = get_self_path();
+#if HAVE_WINDOWS_H
+ progpath = regsub(slash, lit("/"), progpath);
+#endif
reg_var(intern(lit("stdlib"), user_package),
sysroot(lit("share/txr/stdlib")));
}