读取IOS的相应路径

//    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的相应路径,布布扣,bubuko.com

读取IOS的相应路径

上一篇:android 反编译 for mac


下一篇:Android jni aes加解密,实现文件的加解密,具体实现可以自行修改,上面的代码为简单介绍,下面的是JNI端实现文件加解密,可以修改为字符串加解密