Fix bug recognising path extensions

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@27309 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
rfm 2008-12-16 19:31:50 +00:00
parent c1964b83f3
commit cc185cf00e
4 changed files with 18 additions and 22 deletions

View file

@ -1,3 +1,8 @@
2008-12-16 Richard Frith-Macdonald <rfm@gnu.org>
* Source/NSWorkspace.m: Fix problem failing to recognise path extension
where the role is blank.
2008-12-16 Fred Kiefer <FredKiefer@gmx.de> 2008-12-16 Fred Kiefer <FredKiefer@gmx.de>
* Source/NSButtonCell.m (-setImage:): Call super implementation to * Source/NSButtonCell.m (-setImage:): Call super implementation to

View file

@ -654,8 +654,7 @@ static NSNull *null = nil;
unsigned count; unsigned count;
imageTypes = [NSImage imageFileTypes]; imageTypes = [NSImage imageFileTypes];
for (count = 0, image = nil; image == nil && count < [imageTypes count]; for (count = 0; count < [imageTypes count]; count++)
count++)
{ {
NSString *ext = [imageTypes objectAtIndex: count]; NSString *ext = [imageTypes objectAtIndex: count];

View file

@ -151,9 +151,7 @@ setPath(NSBrowser *browser, NSString *path)
NSString *file = [[names lastObject] stringByStandardizingPath]; NSString *file = [[names lastObject] stringByStandardizingPath];
BOOL isDir; BOOL isDir;
if (file && if (file && [_fm fileExistsAtPath: file isDirectory: &isDir] && isDir)
[_fm fileExistsAtPath: file isDirectory: &isDir] &&
isDir)
{ {
[self setDirectory: file]; [self setDirectory: file];
} }
@ -1666,14 +1664,13 @@ createRowsForColumn: (int)column
exists = [_fm fileExistsAtPath: pathAndFile exists = [_fm fileExistsAtPath: pathAndFile
isDirectory: &isDir]; isDirectory: &isDir];
if (isDir && !_treatsFilePackagesAsDirectories if (isDir && !_treatsFilePackagesAsDirectories
&& [ws isFilePackageAtPath: pathAndFile]) && [ws isFilePackageAtPath: pathAndFile])
{ {
isDir = NO; isDir = NO;
} }
if (_delegateHasShowFilenameFilter) if (_delegateHasShowFilenameFilter)
{ {
exists = [_delegate panel: self exists = [_delegate panel: self shouldShowFilename: pathAndFile];
shouldShowFilename: pathAndFile];
} }
if (exists && !isDir) if (exists && !isDir)

View file

@ -1221,14 +1221,14 @@ inFileViewerRootedAtPath: (NSString*)rootFullpath
*/ */
extension = [fullPath pathExtension]; extension = [fullPath pathExtension];
if ([extension isEqualToString: @"app"] if ([extension isEqualToString: @"app"]
|| [extension isEqualToString: @"debug"] || [extension isEqualToString: @"debug"]
|| [extension isEqualToString: @"profile"] || [extension isEqualToString: @"profile"]
|| [extension isEqualToString: @"bundle"]) || [extension isEqualToString: @"bundle"])
{ {
return YES; return YES;
} }
else if ([extension length] > 0 else if ([extension length] > 0
&& [self getBestAppInRole: nil forExtension: extension] != nil) && [self getBestAppInRole: nil forExtension: extension] != nil)
{ {
return YES; return YES;
} }
@ -2377,7 +2377,7 @@ inFileViewerRootedAtPath: (NSString*)rootFullpath
/* /*
* If the requested role is 'nil', we can accept an app that is either * 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) while ((appName = [enumerator nextObject]) != nil)
{ {
@ -2385,15 +2385,10 @@ inFileViewerRootedAtPath: (NSString*)rootFullpath
info = [apps objectForKey: appName]; info = [apps objectForKey: appName];
str = [info objectForKey: @"NSRole"]; str = [info objectForKey: @"NSRole"];
if (str == nil || [str isEqualToString: @"Editor"]) if (str == nil
{ || [str isEqualToString: @"Editor"]
if (app != 0) || [str isEqualToString: @"Viewer"]
{ || [str isEqualToString: @""])
*app = appName;
}
return YES;
}
else if ([str isEqualToString: @"Viewer"])
{ {
if (app != 0) if (app != 0)
{ {