Last active
September 17, 2016 19:15
-
-
Save mminer/82aacea8896cf2660ef6de5a1b9ffd66 to your computer and use it in GitHub Desktop.
Finds the user's home directory inside a sandboxed Cocoa application.
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
import Foundation | |
let homeDirectory: String = { | |
let home = getpwuid(getuid()).pointee.pw_dir! | |
return FileManager.default.string(withFileSystemRepresentation: home, length: Int(strlen(home))) | |
}() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment