How to get custom folder locations on Mac OS X using Objective-C

How to get file location in mac os using object c?

/Users/objc/Downloads/x.pdf

Any foundation classes for this?

please give me an example code.

+5
source share
1 answer

Not sure if you understand what you want, but you get the user's home directory with:

NSArray *docDirs = NSSearchPathForDirectoriesInDomains(
                    NSDownloadsDirectory,
                    NSUserDomainMask, YES);
NSString *doc = [docDirs objectAtIndex:0];

And then you can build the path:

NSString *path = [NSString stringWithFormat:@"%@/x.pdf", doc];
+6
source

All Articles