WakkaDroid
WakkaDroid

Reputation: 138

Is there a way to find the users folder name in objective C?

I have this code that I use to create a directory, but I want it to be able to go into anyone's folder, obviously. For example instead of ksmith I'd want it to find someone's jlaw. Is there something in objective c that does that?

strcpy(applicationPath, "/Users/ksmith/ApplicationCode");
strcpy(filesPath, "/Users/ksmith/ApplicationData");

Upvotes: 0

Views: 46

Answers (1)

Palle
Palle

Reputation: 12129

You can retrieve the path to the current user’s home directory with the function

NSHomeDirectory()

For more information and related functions: Apple Documentation.

Upvotes: 2

Related Questions