[Pkg-owncloud-commits] [owncloud-client] 150/219: MacOverlays: Pass isDir flag to isRegisteredPath method

Sandro Knauß hefee-guest at moszumanska.debian.org
Sat Oct 11 14:43:20 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 688b8dcc38130e7d835219bbb34e5db83897748a
Author: Klaas Freitag <freitag at owncloud.com>
Date:   Tue Sep 23 10:22:40 2014 +0200

    MacOverlays: Pass isDir flag to isRegisteredPath method
    
    With that, a path can be added to directories to also detect the
    sync top directory.
    
    This fixes bug #2053
---
 shell_integration/MacOSX/OwnCloudFinder/ContentManager.m |  4 ++--
 shell_integration/MacOSX/OwnCloudFinder/RequestManager.h |  2 +-
 shell_integration/MacOSX/OwnCloudFinder/RequestManager.m | 14 ++++++++++----
 3 files changed, 13 insertions(+), 7 deletions(-)

diff --git a/shell_integration/MacOSX/OwnCloudFinder/ContentManager.m b/shell_integration/MacOSX/OwnCloudFinder/ContentManager.m
index 5fd17de..b9e49e7 100644
--- a/shell_integration/MacOSX/OwnCloudFinder/ContentManager.m
+++ b/shell_integration/MacOSX/OwnCloudFinder/ContentManager.m
@@ -139,7 +139,7 @@ static ContentManager* sharedInstance = nil;
 	}
 	NSString* normalizedPath = [path decomposedStringWithCanonicalMapping];
 
-	if (![[RequestManager sharedInstance] isRegisteredPath:normalizedPath]) {
+	if (![[RequestManager sharedInstance] isRegisteredPath:normalizedPath isDirectory:isDir]) {
 		return [NSNumber numberWithInt:0];
 	}
 	
@@ -192,7 +192,7 @@ static ContentManager* sharedInstance = nil;
 
 - (void)reFetchFileNameCacheForPath:(NSString*)path
 {
-	NSLog(@"%@", NSStringFromSelector(_cmd));
+	// NSLog(@"%@", NSStringFromSelector(_cmd));
 
 	for (id p in [_fileNamesCache keyEnumerator]) {
 		if ( path && [p hasPrefix:path] ) {
diff --git a/shell_integration/MacOSX/OwnCloudFinder/RequestManager.h b/shell_integration/MacOSX/OwnCloudFinder/RequestManager.h
index 8228bf9..0de2611 100644
--- a/shell_integration/MacOSX/OwnCloudFinder/RequestManager.h
+++ b/shell_integration/MacOSX/OwnCloudFinder/RequestManager.h
@@ -31,7 +31,7 @@
 
 + (RequestManager*)sharedInstance;
 
-- (BOOL)isRegisteredPath:(NSString*)path;
+- (BOOL)isRegisteredPath:(NSString*)path isDirectory:(BOOL)isDir;
 - (void)askOnSocket:(NSString*)path query:(NSString*)verb;
 - (NSNumber*)askForIcon:(NSString*)path isDirectory:(BOOL)isDir;
 - (void)menuItemClicked:(NSDictionary*)actionDictionary;
diff --git a/shell_integration/MacOSX/OwnCloudFinder/RequestManager.m b/shell_integration/MacOSX/OwnCloudFinder/RequestManager.m
index cc139c6..0207b8c 100644
--- a/shell_integration/MacOSX/OwnCloudFinder/RequestManager.m
+++ b/shell_integration/MacOSX/OwnCloudFinder/RequestManager.m
@@ -77,14 +77,20 @@ static RequestManager* sharedInstance = nil;
 }
 
 
-- (BOOL)isRegisteredPath:(NSString*)path
+- (BOOL)isRegisteredPath:(NSString*)path isDirectory:(BOOL)isDir
 {
 	// check if the file in question is underneath a registered directory
 	NSArray *regPathes = [_registeredPathes allKeys];
 	BOOL registered = NO;
 
+	NSString* checkPath = [[NSString alloc] initWithString:path];
+	if (isDir) {
+		// append a slash
+		checkPath = [path stringByAppendingString:@"/"];
+	}
+
 	for( NSString *regPath in regPathes ) {
-		if( [path hasPrefix:regPath]) {
+		if( [checkPath hasPrefix:regPath]) {
 			// the path was registered
 			registered = YES;
 			break;
@@ -99,7 +105,7 @@ static RequestManager* sharedInstance = nil;
 	NSString *verb = @"RETRIEVE_FILE_STATUS";
 	NSNumber *res = [NSNumber numberWithInt:0];
 
-	if( [self isRegisteredPath:path] ) {
+	if( [self isRegisteredPath:path isDirectory:isDir] ) {
 		if( _isConnected ) {
 			if(isDir) {
 				verb = @"RETRIEVE_FOLDER_STATUS";
@@ -140,11 +146,11 @@ static RequestManager* sharedInstance = nil;
 		} else if( [[chunks objectAtIndex:0 ] isEqualToString:@"REGISTER_PATH"] ) {
 			NSNumber *one = [NSNumber numberWithInt:1];
 			NSString *path = [chunks objectAtIndex:1];
+			NSLog(@"Registering path: %@", path);
 			[_registeredPathes setObject:one forKey:path];
 			
 			[contentman repaintAllWindows];
 		} else if( [[chunks objectAtIndex:0 ] isEqualToString:@"UNREGISTER_PATH"] ) {
-			NSNumber *one = [NSNumber numberWithInt:1];
 			NSString *path = [chunks objectAtIndex:1];
 			[_registeredPathes removeObjectForKey:path];
 

-- 
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