diff --git a/ChangeLog b/ChangeLog index db0c6f4d9..b41a2b3ae 100644 --- a/ChangeLog +++ b/ChangeLog @@ -33,6 +33,15 @@ Sat May 3 12:28:48 1997 Andrew McCallum Use NSBundle's pathForResource:ofType:inDirectory method properly. (Reported by Stevo Crvenkovski .) +Fri Apr 25 01:30:00 1997 Richard Frith-Macdonald + + * src/NSBundle.m: + Added missing methods to conform to OpenStep spec, also added + [+ pathForResource:ofType:inDirectory:] + + * src/include/NSBundle.h: + Added missing methods to conform to OpenStep spec. + Thu Apr 24 10:30:00 1997 Richard Frith-Macdonald * src/Makefile.in: Added stuff to build and install the name diff --git a/Headers/gnustep/base/NSBundle.h b/Headers/gnustep/base/NSBundle.h index f2c01725c..4349fa7ca 100644 --- a/Headers/gnustep/base/NSBundle.h +++ b/Headers/gnustep/base/NSBundle.h @@ -43,21 +43,31 @@ extern NSString* NSLoadedClasses; unsigned int _retainCount; unsigned int _bundleType; BOOL _codeLoaded; + unsigned int _version; } + (NSBundle *) mainBundle; + (NSBundle *) bundleForClass: (Class)aClass; + (NSBundle *) bundleWithPath: (NSString *)path; ++ (NSString *) pathForResource: (NSString *)name + ofType: (NSString *)ext + inDirectory: (NSString *)bundlePath + withVersion: (int)version; - initWithPath: (NSString *)path; - (NSString *) bundlePath; - (Class) classNamed: (NSString *)className; - (Class) principalClass; +- (unsigned) bundleVersion; +- (void) setBundleVersion: (unsigned)version; - (NSArray *) pathsForResourcesOfType: (NSString *)extension inDirectory: (NSString *)bundlePath; + (NSString *) pathForResource: (NSString *)name ofType: (NSString *)ext inDirectory: (NSString *)bundlePath; ++ (NSString *) pathForResource: (NSString *)name + ofType: (NSString *)ext + inDirectory: (NSString *)bundlePath; - (NSString *) pathForResource: (NSString *)name ofType: (NSString *)ext; - (NSString *) localizedStringForKey: (NSString *)key diff --git a/Source/NSBundle.m b/Source/NSBundle.m index 2e8b8e56b..df13805b8 100644 --- a/Source/NSBundle.m +++ b/Source/NSBundle.m @@ -274,6 +274,27 @@ _bundle_load_callback(Class theClass, Category *theCategory) return [[[NSBundle alloc] initWithPath: path] autorelease]; } ++ (NSString *) pathForResource: (NSString *)name + ofType: (NSString *)ext + inDirectory: (NSString *)bundlePath +{ + return [self pathForResource:name + ofType:ext + inDirectory:bundlePath + withVersion:0]; +} + ++ (NSString *) pathForResource: (NSString *)name + ofType: (NSString *)ext + inDirectory: (NSString *)bundlePath + withVersion: (int)version +{ + NSBundle* bundle = [NSBundle bundleWithPath:bundlePath]; + + [bundle setBundleVersion:version]; + return [bundle pathForResource:name ofType:ext inDirectory:nil]; +} + - initWithPath:(NSString *)path; { struct stat statbuf; @@ -671,4 +692,17 @@ _bundle_load_callback(Class theClass, Category *theCategory) return _infoDict; } +- (unsigned)bundleVersion +{ + return _version; +} + +/* Since I don't know how version numbers should behave - the version + number is not used. (FIXME) +*/ +- (void)setBundleVersion:(unsigned)version +{ + _version = version; +} + @end