Revision: 6936
          http://skim-app.svn.sourceforge.net/skim-app/?rev=6936&view=rev
Author:   hofman
Date:     2010-12-06 00:37:19 +0000 (Mon, 06 Dec 2010)

Log Message:
-----------
ignore package contents and hidden folders when opening content of folder

Modified Paths:
--------------
    trunk/SKDocumentController.m

Modified: trunk/SKDocumentController.m
===================================================================
--- trunk/SKDocumentController.m        2010-12-05 12:48:19 UTC (rev 6935)
+++ trunk/SKDocumentController.m        2010-12-06 00:37:19 UTC (rev 6936)
@@ -116,6 +116,10 @@
     return [super runModalOpenPanel:openPanel forTypes:extensions];
 }
 
+static BOOL isFolderAtPath(NSString *path) {
+    return [[NSWorkspace sharedWorkspace] type:[[NSWorkspace sharedWorkspace] 
typeOfFile:path error:NULL] conformsToType:(NSString *)kUTTypeFolder];
+}
+
 - (NSString *)typeForContentsOfURL:(NSURL *)inAbsoluteURL error:(NSError 
**)outError {
     NSUInteger headerLength = 5;
     
@@ -134,7 +138,7 @@
     NSString *type = [super typeForContentsOfURL:inAbsoluteURL error:&error];
     
     // folders are not recognized, so we have to check for those ourselves, 
rdar://problem/7056540
-    if ([[NSWorkspace sharedWorkspace] type:[[NSWorkspace sharedWorkspace] 
typeOfFile:[inAbsoluteURL path] error:NULL] conformsToType:(NSString 
*)kUTTypeFolder]) {
+    if (isFolderAtPath([inAbsoluteURL path])) {
         type = SKFolderDocumentType;
     } else if ([self documentClassForType:type] == NULL) {
         // "open -f" creates a temporary file with a .txt extension, we want 
to be able to open these file as it can be very handy to e.g. display man pages 
and pretty printed text file from the command line
@@ -312,9 +316,13 @@
         BOOL failed = NO;
         
         while (path = [dirEnum nextObject]) {
-            NSURL *url = [NSURL fileURLWithPath:[basePath 
stringByAppendingPathComponent:path]];
+            NSString *fullPath = [basePath 
stringByAppendingPathComponent:path];
+            NSURL *url = [NSURL fileURLWithPath:fullPath];
             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.

------------------------------------------------------------------------------
What happens now with your Lotus Notes apps - do you make another costly 
upgrade, or settle for being marooned without product support? Time to move
off Lotus Notes and onto the cloud with Force.com, apps are easier to build,
use, and manage than apps on traditional platforms. Sign up for the Lotus 
Notes Migration Kit to learn more. http://p.sf.net/sfu/salesforce-d2d
_______________________________________________
Skim-app-commit mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/skim-app-commit

Reply via email to