Get current user's home directory

前端 未结 3 892
终归单人心
终归单人心 2021-02-18 23:50

I\'m developing a Cocoa Objective-C application that will run on Mac OS X. I need to get the full path of the current user\'s home directory:

/Users/MyUser/

3条回答
  •  长发绾君心
    2021-02-19 00:37

    Since macOS 10.12 you can also use FileManager.default.homeDirectoryForCurrentUser, see the documentation.

提交回复
热议问题