Workspace fix.

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@14624 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
CaS 2002-10-02 04:35:25 +00:00
parent 9d8d7f9fde
commit 5ab6e68dd7
2 changed files with 77 additions and 42 deletions

View file

@ -1,3 +1,9 @@
2002-10-01 Richard Frith-Macdonald <rfm@gnu.org>
* Source/NSWorkspace.m: ([-gtInfoForFile:application:type:])
Try to return a plain file type for directories which are openable
by some app.
2002-10-01 Adam Fedor <fedor@gnu.org> 2002-10-01 Adam Fedor <fedor@gnu.org>
* Tools/gsnd/portaudio/pa_unix_oss/pa_unix_oss.c * Tools/gsnd/portaudio/pa_unix_oss/pa_unix_oss.c

View file

@ -583,6 +583,31 @@ inFileViewerRootedAtPath: (NSString*)rootFullpath
return NO; return NO;
} }
/**
* This method gets information about the file at fullPath and
* returns YES on success, NO if the named file could not be
* found.<br />
* On success, the name of the preferred application for opening
* the file is returned in *appName, or nil if there is no known
* application to open it.<br />
* The returned value in *type describes the file using one of
* the following constants.
* <deflist>
* <term>NSPlainFileType</term>
* <desc>
* A plain file or a directory that some application
* claims to be able to open like a file.
* </desc>
* <term>NSDirectoryFileType</term>
* <desc>An untyped directory</desc>
* <term>NSApplicationFileType</term>
* <desc>A GNUstep application</desc>
* <term>NSFilesystemFileType</term>
* <desc>A file system mount point</desc>
* <term>NSShellCommandFileType</term>
* <desc>Executable shell command</desc>
* </deflist>
*/
- (BOOL) getInfoForFile: (NSString*)fullPath - (BOOL) getInfoForFile: (NSString*)fullPath
application: (NSString **)appName application: (NSString **)appName
type: (NSString **)type type: (NSString **)type
@ -593,59 +618,63 @@ inFileViewerRootedAtPath: (NSString*)rootFullpath
NSString *extension = [fullPath pathExtension]; NSString *extension = [fullPath pathExtension];
attributes = [fm fileAttributesAtPath: fullPath traverseLink: YES]; attributes = [fm fileAttributesAtPath: fullPath traverseLink: YES];
if (attributes != nil) if (attributes != nil)
{ {
*appName = [self getBestAppInRole: nil forExtension: extension];
fileType = [attributes fileType]; fileType = [attributes fileType];
if ([fileType isEqualToString: NSFileTypeRegular]) if ([fileType isEqualToString: NSFileTypeRegular])
{ {
if ([attributes filePosixPermissions] & PosixExecutePermission) if ([attributes filePosixPermissions] & PosixExecutePermission)
{ {
*type = NSShellCommandFileType; *type = NSShellCommandFileType;
*appName = nil; }
} else
else {
{ *type = NSPlainFileType;
*type = NSPlainFileType; }
*appName = [self getBestAppInRole: nil forExtension: extension]; }
}
}
else if ([fileType isEqualToString: NSFileTypeDirectory]) else if ([fileType isEqualToString: NSFileTypeDirectory])
{ {
if ([extension isEqualToString: @"app"] if ([extension isEqualToString: @"app"]
|| [extension isEqualToString: @"debug"] || [extension isEqualToString: @"debug"]
|| [extension isEqualToString: @"profile"]) || [extension isEqualToString: @"profile"])
{ {
*type = NSApplicationFileType; *type = NSApplicationFileType;
*appName = nil; }
} else if ([extension isEqualToString: @"bundle"])
else if ([extension isEqualToString: @"bundle"]) {
{ *type = NSPlainFileType;
*type = NSPlainFileType; }
*appName = nil; else if (*appName != nil)
} {
// the idea here is that if the parent directory's fileSystemNumber *type = NSPlainFileType;
// differs, this must be a filesystem mount point }
else if ([[fm fileAttributesAtPath: /*
* The idea here is that if the parent directory's
* fileSystemNumber differs, this must be a filesystem
* mount point.
*/
else if ([[fm fileAttributesAtPath:
[fullPath stringByDeletingLastPathComponent] [fullPath stringByDeletingLastPathComponent]
traverseLink: YES] fileSystemNumber] traverseLink: YES] fileSystemNumber]
!= [attributes fileSystemNumber]) != [attributes fileSystemNumber])
{ {
*type = NSFilesystemFileType; *type = NSFilesystemFileType;
*appName = nil; }
} else
else {
{ *type = NSDirectoryFileType;
*type = NSDirectoryFileType; }
*appName = nil; }
}
}
else else
{ {
// this catches sockets, character special, block special, and /*
// unknown file types * This catches sockets, character special, block special,
*type = NSPlainFileType; * and unknown file types
*appName = nil; */
} *type = NSPlainFileType;
}
return YES; return YES;
} }
else else