Created
October 7, 2015 22:39
-
-
Save mortenjust/fedf0a297d8b7e904826 to your computer and use it in GitHub Desktop.
This file contains hidden or 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 openAndSelectFile(filename:String){ | |
let files = [NSURL(fileURLWithPath: filename)]; | |
NSWorkspace.sharedWorkspace().activateFileViewerSelectingURLs(files); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
swift 5.x:
func openAndSelectFile(filename:String){
let files = [URL(fileURLWithPath: filename)];
NSWorkspace.shared.activateFileViewerSelecting(files);
}