From afed87226a8b3cf2622e1d4f9eaf7523d9fdb977 Mon Sep 17 00:00:00 2001 From: Fred Kiefer Date: Mon, 26 Nov 2001 20:28:34 +0000 Subject: [PATCH] Extracted new method [pathForNibResource:] for NSWindowController. git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@11545 72102866-910b-0410-8b05-ffd578937521 --- Source/NSBundleAdditions.m | 28 ++++++++++++++++++---------- 1 file changed, 18 insertions(+), 10 deletions(-) diff --git a/Source/NSBundleAdditions.m b/Source/NSBundleAdditions.m index d673861dd..2600fdf24 100644 --- a/Source/NSBundleAdditions.m +++ b/Source/NSBundleAdditions.m @@ -314,9 +314,7 @@ Class gmodel_class(void) withZone: [owner zone]]; } -- (BOOL) loadNibFile: (NSString*)fileName - externalNameTable: (NSDictionary*)context - withZone: (NSZone*)zone +- (NSString *) pathForNibResource: (NSString *)fileName { NSFileManager *mgr = [NSFileManager defaultManager]; NSMutableArray *array = [NSMutableArray arrayWithCapacity: 8]; @@ -378,23 +376,33 @@ Class gmodel_class(void) } } } - return [NSBundle loadNibFile: path - externalNameTable: context - withZone: (NSZone*)zone]; + return path; } else { path = [rootPath stringByAppendingPathExtension: ext]; if([mgr isReadableFileAtPath: path]) { - return [NSBundle loadNibFile: path - externalNameTable: context - withZone: (NSZone*)zone]; + return path; } } } - return NO; + return nil; +} + +- (BOOL) loadNibFile: (NSString*)fileName + externalNameTable: (NSDictionary*)context + withZone: (NSZone*)zone +{ + NSString *path = [self pathForNibResource: fileName]; + + if (path != nil) + return [NSBundle loadNibFile: path + externalNameTable: context + withZone: (NSZone*)zone]; + else + return NO; } @end