diff options
| author | user <user@clank> | 2026-08-19 15:25:28 +0200 |
|---|---|---|
| committer | user <user@clank> | 2026-08-19 15:25:28 +0200 |
| commit | 49ac13f70aa3a9224e90699fe68d8463909239db (patch) | |
| tree | 303c3cee9492e23de6a1f0afc7b2feffeba5c6aa /src/main.c | |
| parent | slosh: the logo flies into place -- a particle engine, statelessly (diff) | |
| download | slosh-49ac13f70aa3a9224e90699fe68d8463909239db.tar.gz slosh-49ac13f70aa3a9224e90699fe68d8463909239db.tar.xz slosh-49ac13f70aa3a9224e90699fe68d8463909239db.zip | |
slosh: layout files are *.layout, not *.layout.kdl
The old name argued that the extension should say how to read the
file. The argument lost to a collision: zellij speaks the same KDL
syntax under that same extension with a different schema, and to
anyone arriving from there .kdl said *whose* file it is -- naming the
wrong owner is worse than not naming the parser. So a layout is
x.layout, a project's is slosh.layout, the name says what the file is
and --check says how it was read. (It is still KDL underneath; point
your editor's highlighting at *.layout.)
Nobody's checked-in workspace vanishes on upgrade: the project scan
still finds slosh.layout.kdl, never writes it, and where both
spellings exist the new one wins, because two files disagreeing needs
one answer. The unparseable-file heuristic in --check learned the new
suffix -- it matched '.layout.' with a trailing dot, which the new
name no longer has.
The webdemo overlay moves with it (demo.layout), rebuilt and
boot-checked.
Diffstat (limited to 'src/main.c')
| -rw-r--r-- | src/main.c | 8 |
1 files changed, 7 insertions, 1 deletions
@@ -48,7 +48,13 @@ static bool looks_like_layout(const char *path) { char buf[1024]; kdl_node_t *root = kdl_parse_file(path_expand(path, buf, sizeof buf), NULL, 0); - if (!root) return strstr(path, ".layout.") != NULL; + if (!root) { + /* `x.layout` is the spelling, `x.layout.kdl` the one it replaced: both + * are somebody's layout, whatever it was that would not parse. */ + size_t n = strlen(path), s = strlen(".layout"); + if (n >= s && strcmp(path + n - s, ".layout") == 0) return true; + return strstr(path, ".layout.") != NULL; + } bool layout = false; for (size_t i = 0; i < root->nkids && !layout; i++) { const char *name = root->kids[i] ? root->kids[i]->name : NULL; |
