开发者

How to get the location of the user folders on Mac OS X using Objective-C

开发者 https://www.devze.com 2023-01-19 22:58 出处:网络
How to get the location of the file in mac os using objective c? /Users/objc/Downloads/x.pdf Any foundation classes for this?

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开发者_如何学Python 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];
0

精彩评论

暂无评论...
验证码 换一张
取 消