// IOS相应路径
NSString* bundlePath = [[NSBundle mainBundle] bundlePath];
NSLog(@"bundlePath = %@", bundlePath);
// documents
NSString* documentsDirectory = [NSSearchPathForDirectoriesInDomains(NSDocumentationDirectory, NSUserDomainMask, YES) lastObject];
NSLog(@"documentsDirectory = %@", documentsDirectory);
// Library
NSString* libraryDirectory = [NSSearchPathForDirectoriesInDomains(NSLibraryDirectory, NSUserDomainMask, YES) lastObject];
NSLog(@"libraryDirectory = %@", libraryDirectory);
// Cache
NSString* cacheDirectory = [NSSearchPathForDirectoriesInDomains(NSCachesDirectory, NSUserDomainMask, YES) lastObject];
NSLog(@"cacheDirectory = %@", cacheDirectory);
// 读取路径下所有文件
NSFileManager* fm = [NSFileManager defaultManager];
NSArray* array = [fm contentsOfDirectoryAtPath:MusicPath error:nil];
NSLog(@"%@", array);
//所有文件和文件夹
NSDirectoryEnumerator* dirEnum = [fm enumeratorAtPath:MusicPath];
NSLog(@"dirEnum = %@", dirEnum);
for (NSString* fileName in dirEnum) {
NSLog(@"%@", fileName);
}
读取IOS的相应路径