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.
This commit is contained in:
J Logan
2026-05-15 19:43:24 -07:00
committed by GitHub
parent 061ab83bea
commit f8f7e2cdf0
@@ -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)