Skip to content

Instantly share code, notes, and snippets.

@mminer
Last active September 17, 2016 19:15
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mminer/82aacea8896cf2660ef6de5a1b9ffd66 to your computer and use it in GitHub Desktop.
Save mminer/82aacea8896cf2660ef6de5a1b9ffd66 to your computer and use it in GitHub Desktop.
Finds the user's home directory inside a sandboxed Cocoa application.
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