* Source/NSDocumentController.m: Return default type if the

URL is not a file URL and the call to typeFromFileExtension: returns
	nil in typeForContentsOfURL:.


git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@28187 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
gcasa 2009-04-08 02:24:27 +00:00
parent b14f6d35eb
commit 6b3ab20fe5
2 changed files with 14 additions and 4 deletions

View file

@ -122,7 +122,6 @@ static NSDictionary *TypeInfoForHumanReadableName (NSArray *types, NSString *typ
- (IBAction) _openRecentDocument: (id)sender;
@end
/** <p>
NSDocumentController is a class that controls a set of NSDocuments
for an application. As an application delegate, it responds to the
@ -1173,9 +1172,14 @@ static BOOL _shouldClose = YES;
- (NSString *) typeForContentsOfURL: (NSURL *)url error: (NSError **)err
{
// FIXME: open connection and get response to determine mine/type
// Should we only do this if [url isFileURL] is YES?
return [self typeFromFileExtension: [[url path] pathExtension]];
NSString *type = [self typeFromFileExtension: [[url path] pathExtension]];
if([url isFileURL] == NO && type == nil)
{
return [self defaultType];
}
return type;
}
- (NSArray *) fileExtensionsFromType: (NSString *)type