My application is written in Objective-C. How can I get the username and home directory of the current user in directory services?
More: My Cocoa application gets the current username and home directory with getenv ("USER"), getenv ("HOME"). This does not seem to work correctly if the user logs in through directory services. I do chdir ($ HOME) and then run this command: login -fp $ USER and it rejects it because, I think, the login goes through the directory service to authenticate the user, and his username on this system may not match value of $ USER. Similarly, it may have a home directory specified in directory services that is different from $ HOME.
source
share