Marino Faggiana 6 years ago
parent
commit
f0feb068aa
1 changed files with 5 additions and 8 deletions
  1. 5 8
      PickerFileProvider/FileProvider.swift

+ 5 - 8
PickerFileProvider/FileProvider.swift

@@ -893,15 +893,12 @@ class FileProvider: NSFileProviderExtension, CCNetworkingDelegate {
         let fileName = createFileName(fileURL.lastPathComponent, directoryID: directoryParent.directoryID, serverUrl: serverUrl)
         let fileNamePathDirectory = fileProviderStorageURL!.path + "/" + FILEID_IMPORT_METADATA_TEMP + directoryParent.directoryID + fileName
         
-        fileCoordinator.coordinate(readingItemAt: fileURL, options: NSFileCoordinator.ReadingOptions.withoutChanges, error: &error) { (url) in
-            
-            do {
-                try FileManager.default.createDirectory(atPath: fileNamePathDirectory, withIntermediateDirectories: true, attributes: nil)
-            } catch  { }
-            
-            _ = self.copyFile(url.path, toPath: fileNamePathDirectory + "/" + fileName)
-        }
+        do {
+            try FileManager.default.createDirectory(atPath: fileNamePathDirectory, withIntermediateDirectories: true, attributes: nil)
+        } catch  { }
             
+        _ = self.moveFile(fileURL.path, toPath: fileNamePathDirectory + "/" + fileName)
+        
         fileURL.stopAccessingSecurityScopedResource()
         
         // ---------------------------------------------------------------------------------