开发者

How to get a Dir for .ext of Folder

I am creating a iPhone Application that accesses a Folder on the iPhone that has a random extension. For example: folder.g1Polt . Now I have access to this folder since I know my .ext by looking into my files, but it will only work for MY device. How can I retrieve isDir for the actual .ext Below you can see the working code that retrieves the files from this folder but I need to get rid of that .g1Polt and have just

NSString *path = @"/private/var/stash/Themes/";

NSString *path = @"/private/var/stash/Themes.g1Polt/";
contentOfFolder = [[NSFileManager defaultManager] directoryContentsAtPath:path];
NSLog(@"contentOfFolder: %@", contentOfFolder);
directori开发者_开发百科esOfFolder = [[NSMutableArray alloc] initWithCapacity:100];
for (NSString *aPath in contentOfFolder) {
    NSString * fullPath = [path stringByAppendingPathComponent:aPath];

    BOOL isDir;
    if ([[NSFileManager defaultManager] fileExistsAtPath:fullPath isDirectory:&isDir] &&  
isDir) {
        [directoriesOfFolder addObject: fullPath];
    }
}
NSLog(@"dirctories %@", directoriesOfFolder);    

[directoriesOfFolder addObjectsFromArray:contentOfFolder];


It really is not clear what you are trying to achieve.

What I can tell you is that you will no be able to access files outside of your sandbox on the iPhone so you will not be able to get to those files anyway. See the Apple docs for more on the sandbox

Basically you should be working within your own Documents directory.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜