|
@@ -842,17 +842,14 @@ class NCUtility: NSObject {
|
|
return (usedmegabytes, totalmegabytes)
|
|
return (usedmegabytes, totalmegabytes)
|
|
}
|
|
}
|
|
|
|
|
|
- /* "com.limit-point.LivePhoto" */
|
|
|
|
func clearCacheDirectory(_ directory: String) {
|
|
func clearCacheDirectory(_ directory: String) {
|
|
if let cacheURL = FileManager.default.urls(for: .cachesDirectory, in: .userDomainMask).first {
|
|
if let cacheURL = FileManager.default.urls(for: .cachesDirectory, in: .userDomainMask).first {
|
|
- let fullDirectory = cacheURL.appendingPathComponent(directory, isDirectory: true)
|
|
|
|
- let fileManager = FileManager.default
|
|
|
|
do {
|
|
do {
|
|
- // Get the directory contents urls (including subfolders urls)
|
|
|
|
- let directoryContents = try FileManager.default.contentsOfDirectory( at: cacheURL, includingPropertiesForKeys: nil, options: [])
|
|
|
|
|
|
+ let directoryURL = cacheURL.appendingPathComponent(directory, isDirectory: true)
|
|
|
|
+ let directoryContents = try FileManager.default.contentsOfDirectory(at: directoryURL, includingPropertiesForKeys: nil, options: [])
|
|
for file in directoryContents {
|
|
for file in directoryContents {
|
|
do {
|
|
do {
|
|
- try fileManager.removeItem(at: file)
|
|
|
|
|
|
+ try FileManager.default.removeItem(at: file)
|
|
} catch let error as NSError {
|
|
} catch let error as NSError {
|
|
debugPrint("Ooops! Something went wrong: \(error)")
|
|
debugPrint("Ooops! Something went wrong: \(error)")
|
|
}
|
|
}
|