#import "ViewController.h"
@interface ViewController ()
@end
@implementation ViewController
- (void)viewDidLoad {
[super viewDidLoad];
//获取家目录,也就是根目录
NSString * homePath=NSHomeDirectory();
NSLog(@"家目录:%@",homePath);
//获取DocuMents路径
NSArray * pathArr1=NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
NSString * docuPath=[pathArr1 objectAtIndex:0];
NSLog(@"DocuMents路径:%@",docuPath);
//Library路径
NSArray * pathArr2=NSSearchPathForDirectoriesInDomains(NSLibraryDirectory, NSUserDomainMask, YES);
NSString * libPath=[pathArr2 objectAtIndex:0];
NSLog(@"Library路径:%@",libPath);
//获取tmp路径
NSString * tmpPath=NSTemporaryDirectory();
NSLog(@"temp的路径:%@",tmpPath);
//获取Library下的cachPath路径
NSArray * pathArr3=NSSearchPathForDirectoriesInDomains(NSCachesDirectory, NSUserDomainMask, YES);
NSString * cachPath=pathArr3[0];
NSLog(@"cachPath路径:%@",cachPath);
}
- (void)didReceiveMemoryWarning {
[super didReceiveMemoryWarning];
// Dispose of any resources that can be recreated.
}
@end
沙盒路径(OC)
最新推荐文章于 2022-03-18 17:21:00 发布