mirror of
https://github.com/gnustep/libs-gui.git
synced 2025-04-23 05:32:11 +00:00
Simplify loading of gmodels
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@7063 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
589e219147
commit
6d8d917d63
2 changed files with 35 additions and 6 deletions
|
@ -1,3 +1,8 @@
|
|||
2000-07-30 Richard Frith-Macdonald <rfm@gnu.org>
|
||||
|
||||
* Source/NSBundleAdditions.m: patch by borgheron@yahoo.com to simplify
|
||||
loading of gmodel files.
|
||||
|
||||
2000-07-06 Richard Frith-Macdonald <rfm@gnu.org>
|
||||
|
||||
* Source/GNUmakefile: Install GSFontInfo.h
|
||||
|
|
|
@ -49,7 +49,7 @@
|
|||
#include <AppKit/NSWindow.h>
|
||||
#include <AppKit/NSNibConnector.h>
|
||||
#include <AppKit/NSNibLoading.h>
|
||||
|
||||
#include <AppKit/IMLoading.h>
|
||||
|
||||
@implementation NSNibConnector
|
||||
|
||||
|
@ -203,6 +203,17 @@
|
|||
{
|
||||
BOOL loaded = NO;
|
||||
NSUnarchiver *unarchiver = nil;
|
||||
id owner = [context objectForKey: @"NSOwner"];
|
||||
NSString *ext = [fileName pathExtension];
|
||||
|
||||
|
||||
// If the file to be read is a gmodel, use the GMModel method to
|
||||
// read it in and skip the dearchiving below.
|
||||
if([ext isEqualToString: @"gmodel"])
|
||||
{
|
||||
return [GMModel loadIMFile: fileName
|
||||
owner: owner];
|
||||
}
|
||||
|
||||
NS_DURING
|
||||
{
|
||||
|
@ -315,16 +326,18 @@
|
|||
{
|
||||
NSString *path;
|
||||
|
||||
rootPath = [rootPath stringByAppendingPathComponent: fileName];
|
||||
if ([ext isEqualToString: @""] == NO)
|
||||
rootPath = [rootPath stringByAppendingPathComponent: fileName];
|
||||
// If the file does not have an extension, then we need to
|
||||
// figure out what type of model file to load.
|
||||
if ([ext isEqualToString: @""] == YES)
|
||||
{
|
||||
path = [rootPath stringByAppendingPathExtension: ext];
|
||||
path = [rootPath stringByAppendingPathExtension: @"gorm"];
|
||||
if ([mgr isReadableFileAtPath: path] == NO)
|
||||
{
|
||||
path = [rootPath stringByAppendingPathExtension: @".gorm"];
|
||||
path = [rootPath stringByAppendingPathExtension: @"nib"];
|
||||
if ([mgr isReadableFileAtPath: path] == NO)
|
||||
{
|
||||
path = [rootPath stringByAppendingPathExtension: @".nib"];
|
||||
path = [rootPath stringByAppendingPathExtension: @"gmodel"];
|
||||
if ([mgr isReadableFileAtPath: path] == NO)
|
||||
{
|
||||
continue;
|
||||
|
@ -335,7 +348,18 @@
|
|||
externalNameTable: context
|
||||
withZone: (NSZone*)zone];
|
||||
}
|
||||
else
|
||||
{
|
||||
path = [rootPath stringByAppendingPathExtension: ext];
|
||||
if([mgr isReadableFileAtPath: path])
|
||||
{
|
||||
return [NSBundle loadNibFile: path
|
||||
externalNameTable: context
|
||||
withZone: (NSZone*)zone];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return NO;
|
||||
}
|
||||
@end
|
||||
|
|
Loading…
Reference in a new issue