Create version with get information
This commit is contained in:
		| @@ -16,13 +16,12 @@ class ViewController: UIViewController, UIDocumentPickerDelegate { | ||||
|     override func viewDidLoad() { | ||||
|         super.viewDidLoad() | ||||
|         model = (UIApplication.shared.delegate as! AppDelegate).model | ||||
|  | ||||
|         // Do any additional setup after loading the view. | ||||
|     } | ||||
|  | ||||
|      | ||||
|     @IBAction func selectFolder(_ sender: Any) { | ||||
|      | ||||
|         print("ici") | ||||
|         // Create a document picker for directories. | ||||
|         let documentPicker = | ||||
|             UIDocumentPickerViewController(forOpeningContentTypes: [.folder]) | ||||
| @@ -51,6 +50,8 @@ class ViewController: UIViewController, UIDocumentPickerDelegate { | ||||
|  | ||||
|         // Use file coordination for reading and writing any of the URL’s content. | ||||
|         var error: NSError? = nil | ||||
|          | ||||
|         var teslacamFolder = false; | ||||
|         NSFileCoordinator().coordinate(readingItemAt: url, error: &error) { (url) in | ||||
|                  | ||||
|             let keys : [URLResourceKey] = [.nameKey, .isDirectoryKey] | ||||
| @@ -66,15 +67,18 @@ class ViewController: UIViewController, UIDocumentPickerDelegate { | ||||
|                  | ||||
|             for case let file as URL in fileList { | ||||
|                  | ||||
|                 if (file.lastPathComponent.lowercased().contains("teslacam")){ | ||||
|                     print("ici") | ||||
|                     teslacamFolder = true | ||||
|                 } | ||||
|                  | ||||
|                  | ||||
|                  | ||||
|                 let logger = Logger(subsystem: Bundle.main.bundleIdentifier!, category: "network") | ||||
|                 logger.debug("chosen file: \(file.relativeString)") | ||||
|                  | ||||
|                 let filename = file.lastPathComponent; | ||||
|                  | ||||
|                 if (filename.contains(".mp3") || filename.contains(".fseq") ){ | ||||
|                     model?.setStudentAtIndex(model?.getStudentCount() ?? 0, withdraw: filename ) | ||||
|                 } | ||||
|                 model?.setStudentAtIndex(model?.getStudentCount() ?? 0, withdraw: filename ) | ||||
|                  | ||||
|                 // Start accessing the content's security-scoped URL. | ||||
|                 guard file.startAccessingSecurityScopedResource() else { | ||||
| @@ -91,6 +95,8 @@ class ViewController: UIViewController, UIDocumentPickerDelegate { | ||||
|                 file.stopAccessingSecurityScopedResource() | ||||
|             } | ||||
|         } | ||||
|          | ||||
|         (UIApplication.shared.delegate as! AppDelegate).teslacamFolder = teslacamFolder | ||||
|     } | ||||
|      | ||||
|  | ||||
|   | ||||
		Reference in New Issue
	
	Block a user