mirror of
https://github.com/gnustep/libs-gui.git
synced 2025-05-21 21:52:53 +00:00
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:
parent
6fc3726a02
commit
1ff9a64bc3
7 changed files with 65 additions and 32 deletions
|
@ -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"]];
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue