diff options
| author | Danilo M. <danix@danix.xyz> | 2026-09-16 20:14:13 +0200 |
|---|---|---|
| committer | Danilo M. <danix@danix.xyz> | 2026-09-16 20:15:11 +0200 |
| commit | 13236a8545959943a292cf9836d984fb537add25 (patch) | |
| tree | 8857bd8033f0250f84c44a7c5fa5437552deeb38 | |
| parent | 8137155e977f66440bdeac3f5c292d772b481722 (diff) | |
| download | unified-desktop-theme-13236a8545959943a292cf9836d984fb537add25.tar.gz unified-desktop-theme-13236a8545959943a292cf9836d984fb537add25.zip | |
fix: keep a temp-dir render inside the temp dir
The conky dashboard target is an absolute path now that it lives in
another repo, and `out_dir / absolute` discards out_dir, a documented
pathlib behaviour.
For the default in-repo render that is correct: the file genuinely
belongs at that path. For a render aimed anywhere else it is not.
selftest renders every scheme to a temp dir to have rofi parse the
result, so the escaping target rewrote the live file each time,
silently leaving the user's rendered conky.conf set to whichever scheme
was probed last rather than the one they run. Confirmed with a sentinel
line: before the fix it vanished after a selftest, after it survives.
So an absolute target is honoured only when out_dir is the repo, and
rebased under out_dir otherwise. Rebasing unconditionally was the wrong
fix and was caught in testing: it sent the real render into a
home/danix/... tree inside this repo and stopped updating the live file
at all.
Verified both directions: selftest leaves the live file alone and
creates no stray tree, a real render still updates it, and all nine
schemes still pass.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
| -rwxr-xr-x | bin/udt-palette | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/bin/udt-palette b/bin/udt-palette index 7f53e88..9fd202c 100755 --- a/bin/udt-palette +++ b/bin/udt-palette @@ -689,7 +689,20 @@ def generate(roles_path, out_dir, scheme=None): scheme, palette, res, snap_names = load(roles_path, scheme=scheme) written = [] for target, fn, template in TARGETS: - dest = out_dir / target + # A target outside this repo (the conky dashboard) is an absolute path, + # and `out_dir / absolute` discards out_dir entirely. For the real + # render that is what we want, since the file genuinely belongs at that + # path. For a render aimed elsewhere it is not: selftest renders every + # scheme to a temp dir to have rofi parse the result, and an escaping + # absolute target rewrote the live file each time, silently leaving the + # user's config set to whichever scheme was probed last. + # + # So honour an absolute target only for the default in-repo render, and + # rebase it under out_dir whenever a caller asked for somewhere else. + if Path(target).is_absolute() and out_dir != REPO: + dest = out_dir / Path(target).relative_to("/") + else: + dest = out_dir / target if template: src = REPO / template if not src.exists(): |
