From c624f1fa989b98287313dc03c02d4c2b410f0b1c Mon Sep 17 00:00:00 2001 From: Subeom Choi Date: Fri, 24 May 2024 15:04:55 +0900 Subject: [PATCH] change(SabyAppleStorage, SabyApplePreference): add Version1 to name of file --- Source/ApplePreference/Implement/FileValuePreference.swift | 2 +- Source/ApplePreference/Preference.swift | 4 ++-- Source/AppleStorage/Implement/CoreDataArrayStorage.swift | 2 +- Source/AppleStorage/Implement/FileArrayStorage.swift | 2 +- Source/AppleStorage/Implement/FileDictionaryStorage.swift | 2 +- Source/AppleStorage/Implement/FileValueStorage.swift | 2 +- Source/AppleStorage/Storage.swift | 4 ++-- Test/ApplePreference/FileValuePreferenceTest.swift | 2 +- Test/AppleStorage/Implement/FileArrayStorageTest.swift | 2 +- Test/AppleStorage/Implement/FileDictionaryStorageTest.swift | 2 +- Test/AppleStorage/Implement/FileValueStorageTest.swift | 2 +- 11 files changed, 13 insertions(+), 13 deletions(-) diff --git a/Source/ApplePreference/Implement/FileValuePreference.swift b/Source/ApplePreference/Implement/FileValuePreference.swift index 2dfc025..b9ed942 100644 --- a/Source/ApplePreference/Implement/FileValuePreference.swift +++ b/Source/ApplePreference/Implement/FileValuePreference.swift @@ -110,7 +110,7 @@ struct FileValuePreferenceContext { ) } - let url = directoryURL.appendingPathComponent(storageName).appendingPathExtension(STORAGE_VERSION) + let url = directoryURL.appendingPathComponent("\(storageName)_\(STORAGE_VERSION)") if !fileManager.fileExists(atPath: url.path) { return FileValuePreferenceContext( url: url, diff --git a/Source/ApplePreference/Preference.swift b/Source/ApplePreference/Preference.swift index 22f541f..0df4471 100644 --- a/Source/ApplePreference/Preference.swift +++ b/Source/ApplePreference/Preference.swift @@ -10,13 +10,13 @@ import Foundation public protocol Preference { /// ``init(directoryURL:storageName:migration:)`` /// execute migration and then create or load preference from - /// `{Directory url}/{Storage name}/{Version name}` path. + /// `{Directory url}/{Storage name}_{Version name}` path. init(directoryURL: URL, storageName: String, migration: @escaping () throws -> Void) } extension Preference { /// ``init(directoryName:storageName:)`` create or load storage from - /// `{Directory url}/{Storage name}/{Version name}` path. + /// `{Directory url}/{Storage name}_{Version name}` path. public init(directoryURL: URL, storageName: String) { self.init(directoryURL: directoryURL, storageName: storageName, migration: {}) } diff --git a/Source/AppleStorage/Implement/CoreDataArrayStorage.swift b/Source/AppleStorage/Implement/CoreDataArrayStorage.swift index 4c347f1..b3c6758 100644 --- a/Source/AppleStorage/Implement/CoreDataArrayStorage.swift +++ b/Source/AppleStorage/Implement/CoreDataArrayStorage.swift @@ -355,7 +355,7 @@ extension NSManagedObjectContext { ) } - let url = directoryURL.appendingPathComponent(storageName).appendingPathExtension(STORAGE_VERSION) + let url = directoryURL.appendingPathComponent("\(storageName)_\(STORAGE_VERSION)") let container = NSPersistentContainer( name: storageName, diff --git a/Source/AppleStorage/Implement/FileArrayStorage.swift b/Source/AppleStorage/Implement/FileArrayStorage.swift index f9b9994..0d701c3 100644 --- a/Source/AppleStorage/Implement/FileArrayStorage.swift +++ b/Source/AppleStorage/Implement/FileArrayStorage.swift @@ -223,7 +223,7 @@ struct FileArrayStorageContext { ) } - let url = directoryURL.appendingPathComponent(storageName).appendingPathExtension(STORAGE_VERSION) + let url = directoryURL.appendingPathComponent("\(storageName)_\(STORAGE_VERSION)") if !fileManager.fileExists(atPath: url.path) { return FileArrayStorageContext( url: url, diff --git a/Source/AppleStorage/Implement/FileDictionaryStorage.swift b/Source/AppleStorage/Implement/FileDictionaryStorage.swift index 12ab396..01052cd 100644 --- a/Source/AppleStorage/Implement/FileDictionaryStorage.swift +++ b/Source/AppleStorage/Implement/FileDictionaryStorage.swift @@ -136,7 +136,7 @@ struct FileDictionaryStorageContext { ) } - let url = directoryURL.appendingPathComponent(storageName).appendingPathExtension(STORAGE_VERSION) + let url = directoryURL.appendingPathComponent("\(storageName)_\(STORAGE_VERSION)") if !fileManager.fileExists(atPath: url.path) { return FileDictionaryStorageContext( url: url, diff --git a/Source/AppleStorage/Implement/FileValueStorage.swift b/Source/AppleStorage/Implement/FileValueStorage.swift index 6714e97..8b5eea8 100644 --- a/Source/AppleStorage/Implement/FileValueStorage.swift +++ b/Source/AppleStorage/Implement/FileValueStorage.swift @@ -120,7 +120,7 @@ struct FileValueStorageContext { ) } - let url = directoryURL.appendingPathComponent(storageName).appendingPathExtension(STORAGE_VERSION) + let url = directoryURL.appendingPathComponent("\(storageName)_\(STORAGE_VERSION)") if !fileManager.fileExists(atPath: url.path) { return FileValueStorageContext( url: url, diff --git a/Source/AppleStorage/Storage.swift b/Source/AppleStorage/Storage.swift index 65b53d1..9f372a9 100644 --- a/Source/AppleStorage/Storage.swift +++ b/Source/AppleStorage/Storage.swift @@ -11,13 +11,13 @@ import SabyConcurrency public protocol Storage { /// ``init(directoryURL:storageName:migration:)`` /// execute migration and then create or load preference from - /// `{Directory url}/{Storage name}/{Version name}` path. + /// `{Directory url}/{Storage name}_{Version name}` path. init(directoryURL: URL, storageName: String, migration: @escaping () -> Promise) } extension Storage { /// ``init(directoryName:storageName:)`` create or load storage from - /// `{Directory url}/{Storage name}/{Version name}` path. + /// `{Directory url}/{Storage name}_{Version name}` path. public init(directoryURL: URL, storageName: String) { self.init(directoryURL: directoryURL, storageName: storageName, migration: { .resolved(()) }) } diff --git a/Test/ApplePreference/FileValuePreferenceTest.swift b/Test/ApplePreference/FileValuePreferenceTest.swift index 1fe7ce4..63a9afb 100644 --- a/Test/ApplePreference/FileValuePreferenceTest.swift +++ b/Test/ApplePreference/FileValuePreferenceTest.swift @@ -37,7 +37,7 @@ final class FileValuePreferenceTest: XCTestCase { } override func tearDownWithError() throws { - let fileURL = directoryURL.appendingPathComponent(storageName) + let fileURL = directoryURL if FileManager.default.fileExists(atPath: fileURL.absoluteString) { try FileManager.default.removeItem(at: fileURL) diff --git a/Test/AppleStorage/Implement/FileArrayStorageTest.swift b/Test/AppleStorage/Implement/FileArrayStorageTest.swift index 03c4639..da457ba 100644 --- a/Test/AppleStorage/Implement/FileArrayStorageTest.swift +++ b/Test/AppleStorage/Implement/FileArrayStorageTest.swift @@ -46,7 +46,7 @@ final class FileArrayStorageTest: XCTestCase { } override func tearDownWithError() throws { - let fileURL = directoryURL.appendingPathComponent(storageName) + let fileURL = directoryURL if FileManager.default.fileExists(atPath: fileURL.absoluteString) { try FileManager.default.removeItem(at: fileURL) diff --git a/Test/AppleStorage/Implement/FileDictionaryStorageTest.swift b/Test/AppleStorage/Implement/FileDictionaryStorageTest.swift index d11381d..af417a8 100644 --- a/Test/AppleStorage/Implement/FileDictionaryStorageTest.swift +++ b/Test/AppleStorage/Implement/FileDictionaryStorageTest.swift @@ -37,7 +37,7 @@ final class FileDictionaryStorageTest: XCTestCase { } override func tearDownWithError() throws { - let fileURL = directoryURL.appendingPathComponent(storageName) + let fileURL = directoryURL if FileManager.default.fileExists(atPath: fileURL.absoluteString) { try FileManager.default.removeItem(at: fileURL) diff --git a/Test/AppleStorage/Implement/FileValueStorageTest.swift b/Test/AppleStorage/Implement/FileValueStorageTest.swift index a2296bb..c0e4bea 100644 --- a/Test/AppleStorage/Implement/FileValueStorageTest.swift +++ b/Test/AppleStorage/Implement/FileValueStorageTest.swift @@ -37,7 +37,7 @@ final class FileValueStorageTest: XCTestCase { } override func tearDownWithError() throws { - let fileURL = directoryURL.appendingPathComponent(storageName) + let fileURL = directoryURL if FileManager.default.fileExists(atPath: fileURL.absoluteString) { try FileManager.default.removeItem(at: fileURL)