File tree Expand file tree Collapse file tree 5 files changed +17
-16
lines changed Expand file tree Collapse file tree 5 files changed +17
-16
lines changed Original file line number Diff line number Diff line change 3131
3232# IntelliJ
3333.idea /
34+ .vscode
Load Diff This file was deleted.
Original file line number Diff line number Diff line change @@ -164,12 +164,15 @@ final class Files {
164164 let filePath = metaData. filePath
165165 let fileName = filePath. lastPathComponent
166166 let metaDataPath = storageDirectory. appendingPathComponent ( fileName) . appendingPathExtension ( " plist " )
167- let metaDataCachePath = storageDirectory. appendingPathComponent ( " \( metaData. id) uploadData " )
167+ let uploadDataCachePath = storageDirectory. appendingPathComponent ( " \( metaData. id) uploadData " )
168+ let metaDataCachePath = storageDirectory. appendingPathComponent ( " \( metaData. id) " )
168169
169170 try queue. sync {
170171 try FileManager . default. removeItem ( at: metaDataPath)
171- if FileManager . default. fileExists ( atPath: metaDataCachePath. path) {
172- try FileManager . default. removeItem ( at: metaDataCachePath)
172+ try FileManager . default. removeItem ( at: metaDataCachePath)
173+
174+ if FileManager . default. fileExists ( atPath: uploadDataCachePath. path) {
175+ try FileManager . default. removeItem ( at: uploadDataCachePath)
173176 }
174177#if os(iOS)
175178 try FileManager . default. removeItem ( at: filePath)
Original file line number Diff line number Diff line change @@ -45,8 +45,10 @@ final class FilesTests: XCTestCase {
4545 }
4646 }
4747
48- let documentsDirectory = FileManager . default. urls ( for: . documentDirectory, in: . userDomainMask) [ 0 ]
49- let cacheDirectory = FileManager . default. urls ( for: . documentDirectory, in: . userDomainMask) [ 0 ]
48+ let documentsDirectory = FileManager . default. urls ( for: . applicationSupportDirectory, in: . userDomainMask) [ 0 ]
49+ . appendingPathComponent ( Bundle . main. bundleIdentifier ?? " " )
50+ let cacheDirectory = FileManager . default. urls ( for: . applicationSupportDirectory, in: . userDomainMask) [ 0 ]
51+ . appendingPathComponent ( Bundle . main. bundleIdentifier ?? " " )
5052
5153 let values = [
5254 ( URL ( string: " ABC " ) !, documentsDirectory. appendingPathComponent ( " ABC " ) ) ,
@@ -125,7 +127,9 @@ final class FilesTests: XCTestCase {
125127 // Normally we write to the documents dir. But we explicitly are storing a file in a "wrong dir"
126128 // To see if retrieving metadata updates its directory.
127129 func writeDummyFileToCacheDir( ) throws -> URL {
128- let cacheURL = FileManager . default. urls ( for: . cachesDirectory, in: . userDomainMask) [ 0 ]
130+ let cacheURL = FileManager . default. urls ( for: . applicationSupportDirectory, in: . userDomainMask) [ 0 ]
131+ . appendingPathComponent ( Bundle . main. bundleIdentifier ?? " " )
132+ . appendingPathComponent ( " TUS " )
129133 let fileURL = cacheURL. appendingPathComponent ( " abcdefgh.txt " )
130134 return fileURL
131135 }
Original file line number Diff line number Diff line change @@ -16,7 +16,8 @@ final class TUSClient_CacheTests: XCTestCase {
1616
1717 MockURLProtocol . reset ( )
1818
19- let docDir = FileManager . default. urls ( for: . documentDirectory, in: . userDomainMask) [ 0 ]
19+ let docDir = FileManager . default. urls ( for: . applicationSupportDirectory, in: . userDomainMask) [ 0 ]
20+ . appendingPathComponent ( Bundle . main. bundleIdentifier ?? " " )
2021 fullStoragePath = docDir. appendingPathComponent ( relativeStoragePath. absoluteString)
2122
2223 clearDirectory ( dir: fullStoragePath)
@@ -96,7 +97,7 @@ final class TUSClient_CacheTests: XCTestCase {
9697
9798 clearDirectory ( dir: fullStoragePath)
9899
99- client = makeClient ( storagePath: storagePath )
100+ client = makeClient ( storagePath: fullStoragePath )
100101 tusDelegate = TUSMockDelegate ( )
101102 client. delegate = tusDelegate
102103
You can’t perform that action at this time.
0 commit comments