From f8f7e2cdf0c2302f522eaed3b1f7ec33c4fed2af Mon Sep 17 00:00:00 2001 From: J Logan Date: Fri, 15 May 2026 19:43:24 -0700 Subject: [PATCH] Ensure read-only user config removed on every startup. (#1567) - Closes #1566. - Currently on `system start` we only remove the read-only user config if the user config file exists. This means that changes to the config are processed properly on restart, but a removal is ignored, and the old read-only settings linger. --- Sources/ContainerPersistence/ConfigurationLoader.swift | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/Sources/ContainerPersistence/ConfigurationLoader.swift b/Sources/ContainerPersistence/ConfigurationLoader.swift index 5e488c6c..95afc979 100644 --- a/Sources/ContainerPersistence/ConfigurationLoader.swift +++ b/Sources/ContainerPersistence/ConfigurationLoader.swift @@ -198,16 +198,17 @@ public enum ConfigurationLoader { let destPath = configurationFile(in: destBase) let fm = FileManager.default - guard fm.fileExists(atPath: sourcePath.string) else { return } - - let destDir = destPath.removingLastComponent() - try fm.createDirectory(atPath: destDir.string, withIntermediateDirectories: true) if fm.fileExists(atPath: destPath.string) { try fm.setAttributes([.posixPermissions: READ_AND_WRITE], ofItemAtPath: destPath.string) try fm.removeItem(at: URL(filePath: destPath.string)) } + guard fm.fileExists(atPath: sourcePath.string) else { return } + + let destDir = destPath.removingLastComponent() + try fm.createDirectory(atPath: destDir.string, withIntermediateDirectories: true) + try fm.copyItem( at: URL(filePath: sourcePath.string), to: URL(filePath: destPath.string)