aboutsummaryrefslogtreecommitdiffstats
path: root/src/config.c
diff options
context:
space:
mode:
authorPeter Geissler <peter@haxx.in>2026-08-28 15:02:49 +0200
committerPeter Geissler <peter@haxx.in>2026-08-28 15:02:49 +0200
commit22e70baa7172e8487913cceae3d3ec89bbe40627 (patch)
treecd067b59109b829e423995ee10d02f30392ff47a /src/config.c
parentctrl_d_exits: Ctrl-D at a prompt, where the tty cannot do it (diff)
downloadslosh-22e70baa7172e8487913cceae3d3ec89bbe40627.tar.gz
slosh-22e70baa7172e8487913cceae3d3ec89bbe40627.tar.xz
slosh-22e70baa7172e8487913cceae3d3ec89bbe40627.zip
path: an absolute path does not always start with a slash
`include "C:/themes/t.kdl"` on Windows did not fail to find the file. It found a different one, or rather looked for it: absoluteness was tested as `path[0] == '/'`, a drive letter is not that, so the path was read as relative and joined to the including file's directory. The result was cannot open C:/Users/you/cfgA/C:/Users/you/cfgB/t.kdl which at least says what happened. A layout's `cwd="C:/srv/api"` took the same turn through path_resolve() and said nothing at all -- the pane started in the wrong directory, which is the failure this file's own header comment is about. Windows spells absolute three ways and all three now count: rooted on the current drive (`\dir`), rooted on a named one (`C:\dir`, `C:/dir`), and a UNC share. A drive letter has to be followed by a separator to qualify, because `C:file` is relative to the current directory *of that drive* -- a real thing, and not one we can resolve for anyone. Windows-only, deliberately. `C:` is an ordinary file name on POSIX and a path beginning with one is relative there, so reading it as a drive would break the platform that works in order to fix the one that does not.
Diffstat (limited to 'src/config.c')
-rw-r--r--src/config.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/config.c b/src/config.c
index ae22278..f015892 100644
--- a/src/config.c
+++ b/src/config.c
@@ -1933,7 +1933,7 @@ static void include_path(const char *base_file, const char *ref, char *out,
size_t cap) {
char buf[512];
const char *r = path_expand(ref, buf, sizeof buf);
- if (r[0] == '/') {
+ if (path_is_absolute(r)) {
snprintf(out, cap, "%s", r);
return;
}