Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Newer
Older
100644 48 lines (37 sloc) 1.247 kB
dc5be1c Initial check-in.
uli authored
1 //
2 // NSFileManager+VisibleDirectoryContents.m
3 // Shovel
4 //
5 // Created by Uli Kusterer on 01.10.04.
6 // Copyright 2004 M. Uli Kusterer. All rights reserved.
7 //
8
9 #import "NSFileManager+VisibleDirectoryContents.h"
10 #import "NSString+CarbonUtilities.h"
11 #import <Carbon/Carbon.h>
12
13
14 @implementation NSFileManager (UKVisibleDirectoryContents)
15
16 -(NSArray*) visibleDirectoryContentsAtPath: (NSString*)path
17 {
18 NSDirectoryEnumerator* enny = [[NSFileManager defaultManager] enumeratorAtPath: path];
19 NSMutableArray* arr = [NSMutableArray array];
20 NSString* currFN;
21
22 while( (currFN = [enny nextObject]) )
23 {
24 [enny skipDescendents];
25 if( [currFN characterAtIndex: 0] == '.' )
26 continue;
27
28 FSRef fref;
29 FSCatalogInfo info;
30
31 if( [[path stringByAppendingPathComponent: currFN] getFSRef: &fref] )
32 {
33 if( noErr == FSGetCatalogInfo( &fref, kFSCatInfoFinderInfo, &info, NULL, NULL, NULL ) )
34 {
35 FileInfo* finderInfo = (FileInfo*)info.finderInfo;
36 if( (finderInfo->finderFlags & kIsInvisible) == kIsInvisible )
37 continue;
38 }
39 }
40
41 [arr addObject: currFN];
42 }
43
44 return arr;
45 }
46
47 @end
Something went wrong with that request. Please try again.