summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKaz Kylheku <kaz@kylheku.com>2019-02-16 09:30:20 -0800
committerKaz Kylheku <kaz@kylheku.com>2019-02-16 09:30:20 -0800
commiteb087dd466c11ea7526bef86be6874a038824ae6 (patch)
tree94f2306a260c7370403b4df7f2dbaa0aab8e05ad
parent068f93723d37b441234e2315d6c168aeb2854540 (diff)
downloadtxr-eb087dd466c11ea7526bef86be6874a038824ae6.tar.gz
txr-eb087dd466c11ea7526bef86be6874a038824ae6.tar.bz2
txr-eb087dd466c11ea7526bef86be6874a038824ae6.zip
sysrooting: trailing slash needed on directory.
* txr.c (sysroot_init): prog_dir is missing a trailing slash, and this breaks the fallback case when we're running a renamed txr executable in the build directory. The presence of the trailing slash had also been documented for the txr-path variable, which is now obsolescent and undocumented. That is hereby fixed.
-rw-r--r--txr.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/txr.c b/txr.c
index 46d0f63e..b6e14f24 100644
--- a/txr.c
+++ b/txr.c
@@ -290,6 +290,7 @@ static val sysroot(val target)
static void sysroot_init(void)
{
val prog_dir;
+ const wchar_t *psc = wref(coerce(const wchar_t *, path_sep_chars));
#if HAVE_WINDOWS_H
val slash = regex_compile(lit("\\\\"), nil);
@@ -301,6 +302,9 @@ static void sysroot_init(void)
#endif
prog_dir = dir_name(prog_path);
+ if (ref(prog_dir, negone) != chr(psc[0]))
+ prog_dir = format(nil, lit("~a~a"), prog_dir, chr(psc[0]), nao);
+
if (!(maybe_sysroot(lit(TXR_REL_PATH)) ||
maybe_sysroot(lit(TXR_REL_PATH EXE_SUFF)) ||
maybe_sysroot(lit(PROG_NAME)) ||