From fbe7bd7bf897062346f5ab01123b817038ed4775 Mon Sep 17 00:00:00 2001 From: John Rommel Estropia Date: Fri, 29 Dec 2017 00:53:48 +0900 Subject: [PATCH 1/3] update podfile --- CoreStore.podspec | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CoreStore.podspec b/CoreStore.podspec index 30db46f..e4b8a9d 100644 --- a/CoreStore.podspec +++ b/CoreStore.podspec @@ -1,6 +1,6 @@ Pod::Spec.new do |s| s.name = "CoreStore" - s.version = "4.2.4" + s.version = "5.0.0" s.license = "MIT" s.summary = "Unleashing the real power of Core Data with the elegance and safety of Swift" s.homepage = "https://github.com/JohnEstropia/CoreStore" From 51961dd737e709c3f274608b3cf89376b2df0d47 Mon Sep 17 00:00:00 2001 From: Zheng-Xiang Ke Date: Sat, 6 Jan 2018 10:22:44 +0800 Subject: [PATCH 2/3] Migrate external storage --- Sources/DataStack+Migration.swift | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/Sources/DataStack+Migration.swift b/Sources/DataStack+Migration.swift index c6dec22..339c478 100644 --- a/Sources/DataStack+Migration.swift +++ b/Sources/DataStack+Migration.swift @@ -796,6 +796,11 @@ public extension DataStack { throw CoreStoreError(error) } + let externalStorageDirName = "." + fileURL.deletingPathExtension().lastPathComponent + "_SUPPORT" + let temporaryExtenralStorageURL = temporaryDirectoryURL.appendingPathComponent( + externalStorageDirName, + isDirectory: true + ) do { try fileManager.replaceItem( @@ -806,11 +811,23 @@ public extension DataStack { resultingItemURL: nil ) + if fileManager.fileExists(atPath: temporaryExtenralStorageURL.path) { + let extenralStorageURL = fileURL.deletingLastPathComponent().appendingPathComponent(externalStorageDirName, isDirectory: true) + try fileManager.replaceItem( + at: extenralStorageURL as URL, + withItemAt: temporaryExtenralStorageURL, + backupItemName: nil, + options: [], + resultingItemURL: nil + ) + } + progress.completedUnitCount = progress.totalUnitCount } catch { _ = try? fileManager.removeItem(at: temporaryFileURL) + _ = try? fileManager.removeItem(at: temporaryExtenralStorageURL) throw CoreStoreError(error) } } From d9db7e4a8204df904c0e8dd77cff6a7026aebc7b Mon Sep 17 00:00:00 2001 From: Zheng-Xiang Ke Date: Sat, 6 Jan 2018 15:00:53 +0800 Subject: [PATCH 3/3] Typo --- Sources/DataStack+Migration.swift | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Sources/DataStack+Migration.swift b/Sources/DataStack+Migration.swift index 339c478..b4c6028 100644 --- a/Sources/DataStack+Migration.swift +++ b/Sources/DataStack+Migration.swift @@ -797,7 +797,7 @@ public extension DataStack { } let externalStorageDirName = "." + fileURL.deletingPathExtension().lastPathComponent + "_SUPPORT" - let temporaryExtenralStorageURL = temporaryDirectoryURL.appendingPathComponent( + let temporaryExternalStorageURL = temporaryDirectoryURL.appendingPathComponent( externalStorageDirName, isDirectory: true ) @@ -811,11 +811,11 @@ public extension DataStack { resultingItemURL: nil ) - if fileManager.fileExists(atPath: temporaryExtenralStorageURL.path) { + if fileManager.fileExists(atPath: temporaryExternalStorageURL.path) { let extenralStorageURL = fileURL.deletingLastPathComponent().appendingPathComponent(externalStorageDirName, isDirectory: true) try fileManager.replaceItem( at: extenralStorageURL as URL, - withItemAt: temporaryExtenralStorageURL, + withItemAt: temporaryExternalStorageURL, backupItemName: nil, options: [], resultingItemURL: nil @@ -827,7 +827,7 @@ public extension DataStack { catch { _ = try? fileManager.removeItem(at: temporaryFileURL) - _ = try? fileManager.removeItem(at: temporaryExtenralStorageURL) + _ = try? fileManager.removeItem(at: temporaryExternalStorageURL) throw CoreStoreError(error) } }