From cc185cf00eba93288e5307fcd553012baa839d8e Mon Sep 17 00:00:00 2001 From: rfm Date: Tue, 16 Dec 2008 19:31:50 +0000 Subject: [PATCH] Fix bug recognising path extensions git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@27309 72102866-910b-0410-8b05-ffd578937521 --- ChangeLog | 5 +++++ Source/GSTheme.m | 3 +-- Source/NSSavePanel.m | 9 +++------ Source/NSWorkspace.m | 23 +++++++++-------------- 4 files changed, 18 insertions(+), 22 deletions(-) diff --git a/ChangeLog b/ChangeLog index 563148c6d..03b864335 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2008-12-16 Richard Frith-Macdonald + + * Source/NSWorkspace.m: Fix problem failing to recognise path extension + where the role is blank. + 2008-12-16 Fred Kiefer * Source/NSButtonCell.m (-setImage:): Call super implementation to diff --git a/Source/GSTheme.m b/Source/GSTheme.m index c42cf858a..9bc8a6fc4 100644 --- a/Source/GSTheme.m +++ b/Source/GSTheme.m @@ -654,8 +654,7 @@ static NSNull *null = nil; unsigned count; imageTypes = [NSImage imageFileTypes]; - for (count = 0, image = nil; image == nil && count < [imageTypes count]; - count++) + for (count = 0; count < [imageTypes count]; count++) { NSString *ext = [imageTypes objectAtIndex: count]; diff --git a/Source/NSSavePanel.m b/Source/NSSavePanel.m index f0b893131..38657e2a1 100644 --- a/Source/NSSavePanel.m +++ b/Source/NSSavePanel.m @@ -151,9 +151,7 @@ setPath(NSBrowser *browser, NSString *path) NSString *file = [[names lastObject] stringByStandardizingPath]; BOOL isDir; - if (file && - [_fm fileExistsAtPath: file isDirectory: &isDir] && - isDir) + if (file && [_fm fileExistsAtPath: file isDirectory: &isDir] && isDir) { [self setDirectory: file]; } @@ -1666,14 +1664,13 @@ createRowsForColumn: (int)column exists = [_fm fileExistsAtPath: pathAndFile isDirectory: &isDir]; if (isDir && !_treatsFilePackagesAsDirectories - && [ws isFilePackageAtPath: pathAndFile]) + && [ws isFilePackageAtPath: pathAndFile]) { isDir = NO; } if (_delegateHasShowFilenameFilter) { - exists = [_delegate panel: self - shouldShowFilename: pathAndFile]; + exists = [_delegate panel: self shouldShowFilename: pathAndFile]; } if (exists && !isDir) diff --git a/Source/NSWorkspace.m b/Source/NSWorkspace.m index 09e053987..140a48a28 100644 --- a/Source/NSWorkspace.m +++ b/Source/NSWorkspace.m @@ -1221,14 +1221,14 @@ inFileViewerRootedAtPath: (NSString*)rootFullpath */ extension = [fullPath pathExtension]; if ([extension isEqualToString: @"app"] - || [extension isEqualToString: @"debug"] - || [extension isEqualToString: @"profile"] - || [extension isEqualToString: @"bundle"]) + || [extension isEqualToString: @"debug"] + || [extension isEqualToString: @"profile"] + || [extension isEqualToString: @"bundle"]) { return YES; } else if ([extension length] > 0 - && [self getBestAppInRole: nil forExtension: extension] != nil) + && [self getBestAppInRole: nil forExtension: extension] != nil) { return YES; } @@ -2377,7 +2377,7 @@ inFileViewerRootedAtPath: (NSString*)rootFullpath /* * If the requested role is 'nil', we can accept an app that is either - * an Editor (preferred) or a Viewer. + * an Editor (preferred) or a Viewer, or unknown. */ while ((appName = [enumerator nextObject]) != nil) { @@ -2385,15 +2385,10 @@ inFileViewerRootedAtPath: (NSString*)rootFullpath info = [apps objectForKey: appName]; str = [info objectForKey: @"NSRole"]; - if (str == nil || [str isEqualToString: @"Editor"]) - { - if (app != 0) - { - *app = appName; - } - return YES; - } - else if ([str isEqualToString: @"Viewer"]) + if (str == nil + || [str isEqualToString: @"Editor"] + || [str isEqualToString: @"Viewer"] + || [str isEqualToString: @""]) { if (app != 0) {