File tree 5 files changed +17
-16
lines changed
5 files changed +17
-16
lines changed Original file line number Diff line number Diff line change 31
31
32
32
# IntelliJ
33
33
.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 {
164
164
let filePath = metaData. filePath
165
165
let fileName = filePath. lastPathComponent
166
166
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) " )
168
169
169
170
try queue. sync {
170
171
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)
173
176
}
174
177
#if os(iOS)
175
178
try FileManager . default. removeItem ( at: filePath)
Original file line number Diff line number Diff line change @@ -45,8 +45,10 @@ final class FilesTests: XCTestCase {
45
45
}
46
46
}
47
47
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 ?? " " )
50
52
51
53
let values = [
52
54
( URL ( string: " ABC " ) !, documentsDirectory. appendingPathComponent ( " ABC " ) ) ,
@@ -125,7 +127,9 @@ final class FilesTests: XCTestCase {
125
127
// Normally we write to the documents dir. But we explicitly are storing a file in a "wrong dir"
126
128
// To see if retrieving metadata updates its directory.
127
129
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 " )
129
133
let fileURL = cacheURL. appendingPathComponent ( " abcdefgh.txt " )
130
134
return fileURL
131
135
}
Original file line number Diff line number Diff line change @@ -16,7 +16,8 @@ final class TUSClient_CacheTests: XCTestCase {
16
16
17
17
MockURLProtocol . reset ( )
18
18
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 ?? " " )
20
21
fullStoragePath = docDir. appendingPathComponent ( relativeStoragePath. absoluteString)
21
22
22
23
clearDirectory ( dir: fullStoragePath)
@@ -96,7 +97,7 @@ final class TUSClient_CacheTests: XCTestCase {
96
97
97
98
clearDirectory ( dir: fullStoragePath)
98
99
99
- client = makeClient ( storagePath: storagePath )
100
+ client = makeClient ( storagePath: fullStoragePath )
100
101
tusDelegate = TUSMockDelegate ( )
101
102
client. delegate = tusDelegate
102
103
You can’t perform that action at this time.
0 commit comments