DevZer0 DevZer0 - 5 months ago 5x
Swift Question

Get the absolute path of .app bundle in OSX using swift

I am trying to find the path of where a simple OS-X app is running from. i tried this code

let fileManager = NSFileManager.defaultManager()
let path = fileManager.currentDirectoryPath

always has value
how do i get the absolute path, such as if the
is executed from
i would like to get the value

is it possible?


Use NSBundle:

let path = NSBundle.mainBundle().bundleURL.URLByDeletingLastPathComponent!.path!