Hi Wolfgang,
your proposal is definitely cleaner than the current code, which uses
the extensions as the file type. The problem with this proposal is that
it will break all document based applications that call these methods. I
remember adding these methods to get TextEdit to compile, but there I
also had to change the defined types to get this working. That was less
work then changing the application to use the old file extension code. I
would expect the same to be true for other Cocoa applications being
ported over to GNUstep.
I would rather leave the current code in there until we get a real
implementation for it.
Fred
On 01.02.2012 10:12, Wolfgang Lux wrote:
Fred Kiefer wrote:
There hasn't been a gui release in almost a year and now seems as good a time
as ever. Feel free to report any bugs you find on the mailing list or even
better in the bug tracker on Savannah.
Sorry for being late here. I noticed a bug with the implementation of the 10.5+
NSWorkspace methods -filenameExtension:isValidForType:,
-preferredFilenameExtensionForType:, and -typeOfFile:error:. These methods are
supposed to work with UTIs as file types, but the current implementation uses
filename extensions instead of them, which certainly is wrong. I'm not so sure
about the correct fix, however. I think since we don't support UTIs at present,
the best is simply to go down the error path everywhere, i.e.,
- (BOOL) filenameExtension: (NSString *)filenameExtension
isValidForType: (NSString*)typeName
{
// FIXME
// We don't support UTIs yet => can't determine whether extension is valid
return NO;
}
- (NSString *) preferredFilenameExtensionForType: (NSString *)typeName
{
// FIXME
// We don't support UTIs yet => can't determine the preferred extension
return nil;
}
- (NSString *) typeOfFile: (NSString *)absoluteFilePath error: (NSError
**)outError
{
// FIXME
// We don't support UTIs yet => can't determine the file's type
if (outError)
{
*outError = nil;
}
return nil;
}
This certainly gives less meaningful results than the current implementation,
but prevents confusing document types and file extensions in the next release,
which probably will stay around for a while :-)
Wolfgang
_______________________________________________
Gnustep-dev mailing list
Gnustep-dev@gnu.org
https://lists.gnu.org/mailman/listinfo/gnustep-dev