|
@@ -99,24 +99,22 @@ class NCUtilityFileSystem: NSObject {
|
|
|
|
|
|
@objc func moveFile(atPath: String, toPath: String) {
|
|
|
|
|
|
- do {
|
|
|
- try FileManager.default.removeItem(atPath: toPath)
|
|
|
- try FileManager.default.copyItem(atPath: atPath, toPath: toPath)
|
|
|
- try FileManager.default.removeItem(atPath: atPath)
|
|
|
- }
|
|
|
- catch {}
|
|
|
-
|
|
|
+ if atPath == toPath { return }
|
|
|
+
|
|
|
+ try? FileManager.default.removeItem(atPath: toPath)
|
|
|
+ try? FileManager.default.copyItem(atPath: atPath, toPath: toPath)
|
|
|
+ try? FileManager.default.removeItem(atPath: atPath)
|
|
|
}
|
|
|
|
|
|
@objc func moveFileInBackground(atPath: String, toPath: String) {
|
|
|
|
|
|
+ if atPath == toPath { return }
|
|
|
+
|
|
|
DispatchQueue.global().async {
|
|
|
- do {
|
|
|
- try FileManager.default.removeItem(atPath: toPath)
|
|
|
- try FileManager.default.copyItem(atPath: atPath, toPath: toPath)
|
|
|
- try FileManager.default.removeItem(atPath: atPath)
|
|
|
- }
|
|
|
- catch {}
|
|
|
+
|
|
|
+ try? FileManager.default.removeItem(atPath: toPath)
|
|
|
+ try? FileManager.default.copyItem(atPath: atPath, toPath: toPath)
|
|
|
+ try? FileManager.default.removeItem(atPath: atPath)
|
|
|
}
|
|
|
}
|
|
|
}
|