forked from shadowfacts/Tusker
Further tweak persistent store migration
This commit is contained in:
parent
4be2258882
commit
bebe563e8f
|
@ -59,9 +59,11 @@ class MastodonCachePersistentStore: NSPersistentContainer {
|
|||
// can be removed after a sufficient time has passed
|
||||
if accountInfo!.id.contains("/") {
|
||||
for desc in persistentStoreDescriptions {
|
||||
guard let new = desc.url else {
|
||||
guard let new = desc.url,
|
||||
!FileManager.default.fileExists(atPath: new.path) else {
|
||||
continue
|
||||
}
|
||||
do {
|
||||
for ext in ["sqlite", "sqlite-shm", "sqlite-wal"] {
|
||||
var old = new.deletingLastPathComponent()
|
||||
let components = accountInfo!.id.split(separator: "/")
|
||||
|
@ -74,9 +76,10 @@ class MastodonCachePersistentStore: NSPersistentContainer {
|
|||
var expected = new.deletingLastPathComponent()
|
||||
expected.appendPathComponent("\(accountInfo!.persistenceKey)_cache", isDirectory: false)
|
||||
expected.appendPathExtension(ext)
|
||||
try? FileManager.default.moveItem(at: old, to: expected)
|
||||
try FileManager.default.moveItem(at: old, to: expected)
|
||||
}
|
||||
}
|
||||
} catch {}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue