Convert libgmodel to a bundle

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@10615 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
Adam Fedor 2001-07-31 16:57:26 +00:00
parent 6fc3726a02
commit 1ff9a64bc3
7 changed files with 65 additions and 32 deletions

View file

@ -197,6 +197,38 @@
return path;
}
static
Class gmodel_class(void)
{
static Class gmclass = Nil;
if (gmclass == Nil)
{
NSBundle *theBundle;
NSEnumerator *benum;
NSString *path;
/* Find the bundle */
benum = [NSStandardLibraryPaths() objectEnumerator];
while ((path = [benum nextObject]))
{
path = [path stringByAppendingPathComponent: @"Bundles"];
path = [path stringByAppendingPathComponent: @"libgmodel.bundle"];
if ([[NSFileManager defaultManager] fileExistsAtPath: path])
break;
path = nil;
}
NSCAssert(path != nil, @"Unable to load gmodel bundle");
NSDebugLog(@"Loading gmodel from %@", path);
theBundle = [NSBundle bundleWithPath: path];
NSCAssert(theBundle != nil, @"Can't init gmodel bundle");
gmclass = [theBundle classNamed: @"GMModel"];
NSCAssert(gmclass, @"Can't load gmodel bundle");
}
return gmclass;
}
+ (BOOL) loadNibFile: (NSString *)fileName
externalNameTable: (NSDictionary *)context
withZone: (NSZone *)zone
@ -210,7 +242,7 @@
// read it in and skip the dearchiving below.
if([ext isEqualToString: @"gmodel"])
{
return [GMModel loadIMFile: fileName
return [gmodel_class() loadIMFile: fileName
owner: [context objectForKey: @"NSOwner"]];
}