[Pkg-owncloud-commits] [owncloud-client] 284/332: MacOverlays: Rather use FileManager API to check if is directory.

Sandro Knauß hefee-guest at moszumanska.debian.org
Thu Aug 14 21:07:12 UTC 2014


This is an automated email from the git hooks/post-receive script.

hefee-guest pushed a commit to branch master
in repository owncloud-client.

commit 14ed2616062098179216dfdfb21d903803a5fc1d
Author: Klaas Freitag <freitag at owncloud.com>
Date:   Mon Aug 4 12:03:01 2014 +0200

    MacOverlays: Rather use FileManager API to check if is directory.
---
 .../MacOSX/LiferayNativityFinder/ContentManager.h  |  2 +-
 .../MacOSX/LiferayNativityFinder/ContentManager.m  |  2 +-
 .../LiferayNativityFinder/IconOverlayHandlers.m    | 40 ++++++++++------------
 .../MacOSX/LiferayNativityFinder/RequestManager.h  |  2 +-
 .../MacOSX/LiferayNativityFinder/RequestManager.m  |  4 +--
 5 files changed, 24 insertions(+), 26 deletions(-)

diff --git a/shell_integration/MacOSX/LiferayNativityFinder/ContentManager.h b/shell_integration/MacOSX/LiferayNativityFinder/ContentManager.h
index d508ae4..9ac2c3a 100644
--- a/shell_integration/MacOSX/LiferayNativityFinder/ContentManager.h
+++ b/shell_integration/MacOSX/LiferayNativityFinder/ContentManager.h
@@ -32,7 +32,7 @@
 + (ContentManager*)sharedInstance;
 
 - (void)enableFileIcons:(BOOL)enable;
-- (NSNumber*)iconByPath:(NSString*)path isDirectory:(NSNumber*)isDir;
+- (NSNumber*)iconByPath:(NSString*)path isDirectory:(BOOL)isDir;
 - (void)removeAllIcons;
 - (void)removeIcons:(NSArray*)paths;
 - (void)setIcons:(NSDictionary*)iconDictionary filterByFolder:(NSString*)filterFolder;
diff --git a/shell_integration/MacOSX/LiferayNativityFinder/ContentManager.m b/shell_integration/MacOSX/LiferayNativityFinder/ContentManager.m
index de2b3d9..bcaed18 100644
--- a/shell_integration/MacOSX/LiferayNativityFinder/ContentManager.m
+++ b/shell_integration/MacOSX/LiferayNativityFinder/ContentManager.m
@@ -113,7 +113,7 @@ static ContentManager* sharedInstance = nil;
 	[self repaintAllWindows];
 }
 
-- (NSNumber*)iconByPath:(NSString*)path isDirectory:(NSNumber*)isDir
+- (NSNumber*)iconByPath:(NSString*)path isDirectory:(BOOL)isDir
 {
 	if (!_fileIconsEnabled)
 	{
diff --git a/shell_integration/MacOSX/LiferayNativityFinder/IconOverlayHandlers.m b/shell_integration/MacOSX/LiferayNativityFinder/IconOverlayHandlers.m
index d18d803..87519ef 100644
--- a/shell_integration/MacOSX/LiferayNativityFinder/IconOverlayHandlers.m
+++ b/shell_integration/MacOSX/LiferayNativityFinder/IconOverlayHandlers.m
@@ -26,13 +26,12 @@
 
 	NSURL* url = [[NSClassFromString(@"FINode") nodeFromNodeRef:[(TIconAndTextCell*)self node]->fNodeRef] previewItemURL];
 
-	NSError *error;
-    NSNumber *isDir = nil;
-    if (! [url getResourceValue:&isDir forKey:NSURLIsDirectoryKey error:&error]) {
-        // handle error
-		[isDir initWithBool:NO]; // lets assume its a file.
-    }
-	
+    BOOL isDir;
+	if ([[NSFileManager defaultManager] fileExistsAtPath: [url path] isDirectory:&isDir] == NO) {
+		NSLog(@"ERROR: Could not determine file type of %@", [url path]);
+		isDir = NO;
+	}
+
 	NSNumber* imageIndex = [[ContentManager sharedInstance] iconByPath:[url path] isDirectory:isDir];
 
 	NSLog(@"1 The icon index is %d", [imageIndex intValue]);
@@ -71,12 +70,12 @@
 	NSURL* url = [node previewItemURL];
 
 	NSError *error;
-    NSNumber *isDir = nil;
-    if (! [url getResourceValue:&isDir forKey:NSURLIsDirectoryKey error:&error]) {
-        // handle error
-		[isDir initWithBool:NO]; // lets assume its a file.
-    }
-	
+	BOOL isDir;
+	if ([[NSFileManager defaultManager] fileExistsAtPath:[url path] isDirectory:&isDir] == NO) {
+		NSLog(@"ERROR: Could not determine file type of %@", [url path]);
+		isDir = NO;
+	}
+
 	NSNumber* imageIndex = [[ContentManager sharedInstance] iconByPath:[url path] isDirectory:isDir];
 	// NSLog(@"2 The icon index is %d", [imageIndex intValue]);
 
@@ -127,13 +126,6 @@
 
 		NSURL *url;
 
-		NSError *error;
-		NSNumber *isDir = nil;
-		if (! [url getResourceValue:&isDir forKey:NSURLIsDirectoryKey error:&error]) {
-			// handle error
-			[isDir initWithBool:NO]; // lets assume its a file.
-		}
-		
 		if ([fiNode respondsToSelector:@selector(previewItemURL)])
 		{
 			url = [fiNode previewItemURL];
@@ -141,7 +133,13 @@
 		else {
 			return;
 		}
-
+		
+		BOOL isDir;
+		if ([[NSFileManager defaultManager] fileExistsAtPath:[url path] isDirectory: &isDir] == NO) {
+			NSLog(@"ERROR: Could not determine file type of %@", [url path]);
+			isDir = NO;
+		}
+		
 		NSNumber* imageIndex = [[ContentManager sharedInstance] iconByPath:[url path] isDirectory:isDir];
 		NSLog(@"3 The icon index is %d", [imageIndex intValue]);
 
diff --git a/shell_integration/MacOSX/LiferayNativityFinder/RequestManager.h b/shell_integration/MacOSX/LiferayNativityFinder/RequestManager.h
index 3eae9f9..8228bf9 100644
--- a/shell_integration/MacOSX/LiferayNativityFinder/RequestManager.h
+++ b/shell_integration/MacOSX/LiferayNativityFinder/RequestManager.h
@@ -33,7 +33,7 @@
 
 - (BOOL)isRegisteredPath:(NSString*)path;
 - (void)askOnSocket:(NSString*)path query:(NSString*)verb;
-- (NSNumber*)askForIcon:(NSString*)path isDirectory:(NSNumber*)isDir;
+- (NSNumber*)askForIcon:(NSString*)path isDirectory:(BOOL)isDir;
 - (void)menuItemClicked:(NSDictionary*)actionDictionary;
 - (void)start;
 
diff --git a/shell_integration/MacOSX/LiferayNativityFinder/RequestManager.m b/shell_integration/MacOSX/LiferayNativityFinder/RequestManager.m
index ab9600a..2549cda 100644
--- a/shell_integration/MacOSX/LiferayNativityFinder/RequestManager.m
+++ b/shell_integration/MacOSX/LiferayNativityFinder/RequestManager.m
@@ -94,14 +94,14 @@ static RequestManager* sharedInstance = nil;
 	return registered;
 }
 
-- (NSNumber*)askForIcon:(NSString*)path isDirectory:(NSNumber*)isDir
+- (NSNumber*)askForIcon:(NSString*)path isDirectory:(BOOL)isDir
 {
 	NSString *verb = @"RETRIEVE_FILE_STATUS";
 	NSNumber *res = [NSNumber numberWithInt:0];
 
 	if( [self isRegisteredPath:path] ) {
 		if( _isConnected ) {
-			if( [isDir boolValue] ) {
+			if(isDir) {
 				verb = @"RETRIEVE_FOLDER_STATUS";
 			}
 

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-owncloud/owncloud-client.git



More information about the Pkg-owncloud-commits mailing list