How to get the location of the file in mac os using objective c?
/Users/objc/Downloads/x.pdf
Any foundation classes for this?
please give me some sample code.
Not sure whether I 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 construct the path:
NSString *path = [NSString stringWithFormat:@"%@/x.pdf", doc];
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With