mirror of
https://github.com/openclaw/openclaw.git
synced 2026-04-28 22:28:38 +00:00
refactor: rename to openclaw
This commit is contained in:
16
apps/macos/Sources/OpenClaw/UserDefaultsMigration.swift
Normal file
16
apps/macos/Sources/OpenClaw/UserDefaultsMigration.swift
Normal file
@@ -0,0 +1,16 @@
|
||||
import Foundation
|
||||
|
||||
private let legacyDefaultsPrefix = "openclaw."
|
||||
private let defaultsPrefix = "openclaw."
|
||||
|
||||
func migrateLegacyDefaults() {
|
||||
let defaults = UserDefaults.standard
|
||||
let snapshot = defaults.dictionaryRepresentation()
|
||||
for (key, value) in snapshot where key.hasPrefix(legacyDefaultsPrefix) {
|
||||
let suffix = key.dropFirst(legacyDefaultsPrefix.count)
|
||||
let newKey = defaultsPrefix + suffix
|
||||
if defaults.object(forKey: newKey) == nil {
|
||||
defaults.set(value, forKey: newKey)
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user