From eb087dd466c11ea7526bef86be6874a038824ae6 Mon Sep 17 00:00:00 2001 From: Kaz Kylheku Date: Sat, 16 Feb 2019 09:30:20 -0800 Subject: 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. --- txr.c | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'txr.c') 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)) || -- cgit v1.2.3