zoukankan      html  css  js  c++  java
  • 读取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);

        }

  • 相关阅读:
    逆序对的相关问题:bzoj1831,bzoj2431
    bzoj3211,bzoj3038
    hdu 1179最大匹配
    hdu 3038带权并查集
    poj 1733离散化(map)+并查集
    codeforces 369B
    poj 1456
    POJ 1988相对偏移
    poj 1986tarjan模板题
    poj 1330lca模板题离线算法
  • 原文地址:https://www.cnblogs.com/guanliyang/p/3796018.html
Copyright © 2011-2022 走看看