Provide a working implementation for -isFilePackageAtPath: in

NSWorkspace.


git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@27007 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
Wolfgang Lux 2008-11-05 21:49:44 +00:00
parent 9bf94dbf24
commit 4e48499493

View file

@ -1045,10 +1045,14 @@ inFileViewerRootedAtPath: (NSString*)rootFullpath
{
NSImage *image = nil;
NSString *pathExtension = [[fullPath pathExtension] lowercaseString];
NSFileManager *mgr = [NSFileManager defaultManager];
NSDictionary *attributes;
NSString *fileType;
if ([self isFilePackageAtPath: fullPath])
attributes = [mgr fileAttributesAtPath: fullPath traverseLink: YES];
fileType = [attributes objectForKey: NSFileType];
if ([fileType isEqual: NSFileTypeDirectory] == YES)
{
NSFileManager *mgr = [NSFileManager defaultManager];
NSString *iconPath = nil;
BOOL isApplication = NO;
@ -1203,13 +1207,29 @@ inFileViewerRootedAtPath: (NSString*)rootFullpath
{
NSFileManager *mgr = [NSFileManager defaultManager];
NSDictionary *attributes;
NSString *fileType;
NSString *fileType, *extension;
attributes = [mgr fileAttributesAtPath: fullPath traverseLink: YES];
fileType = [attributes objectForKey: NSFileType];
if ([fileType isEqual: NSFileTypeDirectory] == YES)
{
return YES;
/*
* We return YES here exactly when getInfoForFile:application:type:
* considers the directory an application or a plain file
*/
extension = [fullPath pathExtension];
if ([extension isEqualToString: @"app"]
|| [extension isEqualToString: @"debug"]
|| [extension isEqualToString: @"profile"]
|| [extension isEqualToString: @"bundle"])
{
return YES;
}
else if ([extension length] > 0
&& [self getBestAppInRole: nil forExtension: extension] != nil)
{
return YES;
}
}
return NO;
}