mirror of
https://github.com/JohnEstropia/CoreStore.git
synced 2026-04-10 19:26:51 +02:00
Merge branch 'develop' of github.com:JohnEstropia/CoreStore into develop
This commit is contained in:
@@ -215,9 +215,9 @@ let migrationProgress = dataStack.addStorage(
|
|||||||
completion: { (result) -> Void in
|
completion: { (result) -> Void in
|
||||||
switch result {
|
switch result {
|
||||||
case .success(let storage):
|
case .success(let storage):
|
||||||
print("Successfully added sqlite store: \(storage)"
|
print("Successfully added sqlite store: \(storage)")
|
||||||
case .failure(let error):
|
case .failure(let error):
|
||||||
print("Failed adding sqlite store with error: \(error)"
|
print("Failed adding sqlite store with error: \(error)")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -796,6 +796,11 @@ public extension DataStack {
|
|||||||
throw CoreStoreError(error)
|
throw CoreStoreError(error)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
let externalStorageDirName = "." + fileURL.deletingPathExtension().lastPathComponent + "_SUPPORT"
|
||||||
|
let temporaryExternalStorageURL = temporaryDirectoryURL.appendingPathComponent(
|
||||||
|
externalStorageDirName,
|
||||||
|
isDirectory: true
|
||||||
|
)
|
||||||
do {
|
do {
|
||||||
|
|
||||||
try fileManager.replaceItem(
|
try fileManager.replaceItem(
|
||||||
@@ -806,11 +811,23 @@ public extension DataStack {
|
|||||||
resultingItemURL: nil
|
resultingItemURL: nil
|
||||||
)
|
)
|
||||||
|
|
||||||
|
if fileManager.fileExists(atPath: temporaryExternalStorageURL.path) {
|
||||||
|
let extenralStorageURL = fileURL.deletingLastPathComponent().appendingPathComponent(externalStorageDirName, isDirectory: true)
|
||||||
|
try fileManager.replaceItem(
|
||||||
|
at: extenralStorageURL as URL,
|
||||||
|
withItemAt: temporaryExternalStorageURL,
|
||||||
|
backupItemName: nil,
|
||||||
|
options: [],
|
||||||
|
resultingItemURL: nil
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
progress.completedUnitCount = progress.totalUnitCount
|
progress.completedUnitCount = progress.totalUnitCount
|
||||||
}
|
}
|
||||||
catch {
|
catch {
|
||||||
|
|
||||||
_ = try? fileManager.removeItem(at: temporaryFileURL)
|
_ = try? fileManager.removeItem(at: temporaryFileURL)
|
||||||
|
_ = try? fileManager.removeItem(at: temporaryExternalStorageURL)
|
||||||
throw CoreStoreError(error)
|
throw CoreStoreError(error)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user