marinofaggiana 4 ani în urmă
părinte
comite
8a01b02e2a
1 a modificat fișierele cu 11 adăugiri și 13 ștergeri
  1. 11 13
      iOSClient/Utility/NCUtilityFileSystem.swift

+ 11 - 13
iOSClient/Utility/NCUtilityFileSystem.swift

@@ -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)
         }
     }
 }