Note that there are some explanatory texts on larger screens.

plurals
  1. POiPhone: NSFilemanager fileExistsAtPath:isDirectory: not working properly?
    text
    copied!<p>I'm working on an app for jailbroken iPhones. I'm trying to get only the directories of an folder. so I'm doing this: </p> <pre><code>NSArray *contentOfFolder = [[NSFileManager defaultManager] directoryContentsAtPath:path]; NSLog(@"contentOfFolder: %@", contentOfFolder); directoriesOfFolder = [[NSMutableArray alloc] initWithCapacity:100]; for (NSString *aPath in contentOfFolder) { NSLog(@"apath: %@", aPath); BOOL isDir; if ([[NSFileManager defaultManager] fileExistsAtPath:aPath isDirectory:&amp;isDir] &amp;&amp;isDir) { [directoriesOfFolder addObject:aPath]; NSLog(@"directoriesOfFolder %@", directoriesOfFolder); } } NSLog(@"dirctories %@", directoriesOfFolder); </code></pre> <p>but look at what I get. when I get the content of the folder everything looks fine:</p> <p>2009-07-28 23:23:35.930 Drowser[573:207] new path /private/var 2009-07-28 23:23:35.945 Drowser[573:207] contentOfFolder: ( Keychains, "Managed Preferences", MobileDevice, backups, cache, db, ea, empty, folders, lib, local, lock, log, logs, mobile, msgs, preferences, root, run, spool, stash, tmp, vm )</p> <p>but then:</p> <p>2009-07-28 23:23:35.950 Drowser[573:207] apath: Keychains 2009-07-28 23:23:35.954 Drowser[573:207] apath: Managed Preferences 2009-07-28 23:23:35.959 Drowser[573:207] apath: MobileDevice 2009-07-28 23:23:35.984 Drowser[573:207] apath: backups 2009-07-28 23:23:35.993 Drowser[573:207] apath: cache 2009-07-28 23:23:36.002 Drowser[573:207] apath: db 2009-07-28 23:23:36.011 Drowser[573:207] apath: ea 2009-07-28 23:23:36.019 Drowser[573:207] apath: empty 2009-07-28 23:23:36.028 Drowser[573:207] apath: folders 2009-07-28 23:23:36.037 Drowser[573:207] apath: lib 2009-07-28 23:23:36.046 Drowser[573:207] directoriesOfFolder ( lib )</p> <p>only "lib"! is recognized as folder. how can that be? the others are folders too. I confirmed it via SSH.</p> <p>does anyone have an idea? Am I doing something wrong?</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload