Created
October 8, 2015 00:30
-
-
Save mortenjust/a5a4775fc365840b3e3c to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
func selectFolder(){ | |
let openPanel = NSOpenPanel(); | |
openPanel.title = "Select a folder to watch for videos" | |
openPanel.message = "Videos you drop in the folder you select will be converted to animated gifs" | |
openPanel.showsResizeIndicator=true; | |
openPanel.canChooseDirectories = true; | |
openPanel.canChooseFiles = false; | |
openPanel.allowsMultipleSelection = false; | |
openPanel.canCreateDirectories = true; | |
openPanel.delegate = self; | |
openPanel.beginWithCompletionHandler { (result) -> Void in | |
if(result == NSFileHandlingPanelOKButton){ | |
let path = openPanel.URL!.path! | |
print("selected folder is \(path)"); | |
// self.watchFolderLabel.stringValue = path; // no need when binding | |
self.savePref("watchFolder", value: path); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Thanks, useful!