Revision: 7740
http://skim-app.svn.sourceforge.net/skim-app/?rev=7740&view=rev
Author: hofman
Date: 2012-10-22 00:13:04 +0000 (Mon, 22 Oct 2012)
Log Message:
-----------
use new directory enumeration method
Modified Paths:
--------------
trunk/SKDocumentController.m
Modified: trunk/SKDocumentController.m
===================================================================
--- trunk/SKDocumentController.m 2012-10-21 12:17:13 UTC (rev 7739)
+++ trunk/SKDocumentController.m 2012-10-22 00:13:04 UTC (rev 7740)
@@ -350,20 +350,23 @@
} else if ([type isEqualToString:SKFolderDocumentType]) {
NSDocument *doc = nil;
NSError *error = nil;
- NSString *basePath = [absoluteURL path];
- NSDirectoryEnumerator *dirEnum = [[NSFileManager defaultManager]
enumeratorAtPath:basePath];
- NSString *path;
+ NSDirectoryEnumerator *dirEnum = [[NSFileManager defaultManager]
+ enumeratorAtURL:absoluteURL
+ includingPropertiesForKeys:[NSArray arrayWithObjects:NSURLNameKey,
NSURLIsDirectoryKey, nil]
+ options:NSDirectoryEnumerationSkipsHiddenFiles
| NSDirectoryEnumerationSkipsPackageDescendants
+ errorHandler:nil];
NSMutableArray *urls = [NSMutableArray array];
BOOL failed = NO;
- while ((path = [dirEnum nextObject])) {
- NSString *fullPath = [basePath
stringByAppendingPathComponent:path];
- NSURL *url = [NSURL fileURLWithPath:fullPath];
- if ([self documentClassForContentsOfURL:url])
+ for (NSURL *url in dirEnum) {
+ NSString *fileName;
+ NSNumber *isDirectory;
+ [url getResourceValue:&fileName forKey:NSURLIsDirectoryKey
error:NULL];
+ [url getResourceValue:&isDirectory forKey:NSURLIsDirectoryKey
error:NULL];
+ if ([isDirectory boolValue] && [fileName hasPrefix:@"."])
+ [dirEnum skipDescendants];
+ else if ([self documentClassForContentsOfURL:url])
[urls addObject:url];
- if ([[[dirEnum fileAttributes] valueForKey:NSFileType]
isEqualToString:NSFileTypeDirectory] &&
- ([[path lastPathComponent] hasPrefix:@"."] || NO ==
isFolderAtPath(fullPath)))
- [dirEnum skipDescendents];
}
if ([urls count] > 10) {
This was sent by the SourceForge.net collaborative development platform, the
world's largest Open Source development site.
------------------------------------------------------------------------------
Everyone hates slow websites. So do we.
Make your web apps faster with AppDynamics
Download AppDynamics Lite for free today:
http://p.sf.net/sfu/appdyn_sfd2d_oct
_______________________________________________
Skim-app-commit mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/skim-app-commit