Marino Faggiana 8 years ago
parent
commit
8251559dbc
1 changed files with 4 additions and 9 deletions
  1. 4 9
      Picker/DocumentPickerViewController.swift

+ 4 - 9
Picker/DocumentPickerViewController.swift

@@ -437,6 +437,7 @@ extension DocumentPickerViewController {
             } catch _ {
             } catch _ {
                 print("file do not exists")
                 print("file do not exists")
             }
             }
+            
             do {
             do {
                 try FileManager.default.copyItem(at: sourceURL, to: destinationURLDirectoryUser)
                 try FileManager.default.copyItem(at: sourceURL, to: destinationURLDirectoryUser)
             } catch _ {
             } catch _ {
@@ -446,7 +447,6 @@ extension DocumentPickerViewController {
 
 
             fileCoordinator.coordinate(readingItemAt: sourceURL, options: .withoutChanges, error: nil, byAccessor: { [weak self] newURL in
             fileCoordinator.coordinate(readingItemAt: sourceURL, options: .withoutChanges, error: nil, byAccessor: { [weak self] newURL in
                 
                 
-                // Remove destination file
                 do {
                 do {
                     try FileManager.default.removeItem(at: (self?.destinationURL)!)
                     try FileManager.default.removeItem(at: (self?.destinationURL)!)
                 } catch _ {
                 } catch _ {
@@ -487,8 +487,7 @@ extension DocumentPickerViewController {
     
     
     func appGroupContainerURL() -> URL? {
     func appGroupContainerURL() -> URL? {
         
         
-        let fileManager = FileManager.default
-        guard let groupURL = fileManager
+        guard let groupURL = FileManager.default
             .containerURL(forSecurityApplicationGroupIdentifier: capabilitiesGroups) else {
             .containerURL(forSecurityApplicationGroupIdentifier: capabilitiesGroups) else {
                 return nil
                 return nil
         }
         }
@@ -496,11 +495,9 @@ extension DocumentPickerViewController {
         let storagePathUrl = groupURL.appendingPathComponent("File Provider Storage")
         let storagePathUrl = groupURL.appendingPathComponent("File Provider Storage")
         let storagePath = storagePathUrl.path
         let storagePath = storagePathUrl.path
         
         
-        if !fileManager.fileExists(atPath: storagePath) {
+        if !FileManager.default.fileExists(atPath: storagePath) {
             do {
             do {
-                try fileManager.createDirectory(atPath: storagePath,
-                                                withIntermediateDirectories: false,
-                                                attributes: nil)
+                try FileManager.default.createDirectory(atPath: storagePath, withIntermediateDirectories: false, attributes: nil)
             } catch let error {
             } catch let error {
                 print("error creating filepath: \(error)")
                 print("error creating filepath: \(error)")
                 return nil
                 return nil
@@ -509,10 +506,8 @@ extension DocumentPickerViewController {
         
         
         return storagePathUrl
         return storagePathUrl
     }
     }
-
 }
 }
 
 
-
 // MARK: - UITableViewDelegate
 // MARK: - UITableViewDelegate
 
 
 extension DocumentPickerViewController: UITableViewDelegate {
 extension DocumentPickerViewController: UITableViewDelegate {