瀏覽代碼

fix document provider

Marino Faggiana 7 年之前
父節點
當前提交
5df065f3fc
共有 1 個文件被更改,包括 3 次插入3 次删除
  1. 3 3
      Picker/DocumentPickerViewController.swift

+ 3 - 3
Picker/DocumentPickerViewController.swift

@@ -426,7 +426,7 @@ extension DocumentPickerViewController {
         case .moveToService, .exportToService:
             
             let fileName = sourceURL.lastPathComponent
-            let destinationURLDirectoryUser = URL(string: "file://\(directoryUser)/\(fileName)".addingPercentEncoding(withAllowedCharacters: .urlPathAllowed)!)!
+            let destinationFileNamePath = "\(directoryUser)/\(fileName)"
             
             destinationURL = appGroupContainerURL()?.appendingPathComponent(fileName)
             
@@ -434,13 +434,13 @@ extension DocumentPickerViewController {
                 
                 // copy sourceURL on directoryUser
                 do {
-                    try FileManager.default.removeItem(at: destinationURLDirectoryUser)
+                    try FileManager.default.removeItem(atPath: destinationFileNamePath)
                 } catch _ {
                     print("file do not exists")
                 }
                 
                 do {
-                    try FileManager.default.copyItem(at: sourceURL, to: destinationURLDirectoryUser)
+                    try FileManager.default.copyItem(atPath: sourceURL.path, toPath: destinationFileNamePath)
                 } catch _ {
                     print("file do not exists")
                     self?.dismissGrantingAccess(to: self?.destinationURL)