From 6af9d5426fb8f33cb7109aed5b54eb31e2ca9a52 Mon Sep 17 00:00:00 2001 From: Hilton Chain Date: Mon, 30 Nov 2026 09:41:11 +0800 Subject: [PATCH] services: home-writable-files-manager: Improve handling of out-of-store files. * modules/rosenthal/home/services/writable-files-manager.scm (update-writable-files-script) [cleanup-writable-files]: Handle copied and symlinked targets differently. [create-writable-files]: Create symlink when source doesn't exist. --- .../rosenthal/home/services/writable-files-manager.scm | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/modules/rosenthal/home/services/writable-files-manager.scm b/modules/rosenthal/home/services/writable-files-manager.scm index d5aaa81..5e75626 100644 --- a/modules/rosenthal/home/services/writable-files-manager.scm +++ b/modules/rosenthal/home/services/writable-files-manager.scm @@ -146,8 +146,9 @@ subdirectory from XDG_CONFIG_HOME to generate a target path." ;; we'll create later, it will be backed up later during ;; create-writable-files phase. (if (or (symlink-to-store? target) - (equal? (file-hash* source) - (file-hash* target))) + (equal? + (file-hash* (if (symbolic-link? target) file source)) + (file-hash* target))) (begin (format #t (G_ "Removing ~a...") target) (delete-file target) @@ -213,7 +214,8 @@ subdirectory from XDG_CONFIG_HOME to generate a target path." (backup-file (strip file))) (format #t (G_ "Copying ~a -> ~a...") source target) - (if (file-is-directory? source) + (if (or (not (file-exists? source)) + (file-is-directory? source)) (symlink source target) (begin (copy-file source target)