From 7a2468d4020d1549fe27aa7176f27df8c8af16bd Mon Sep 17 00:00:00 2001 From: helge Date: Sun, 12 Mar 2006 20:46:56 +0000 Subject: [PATCH] fixed API git-svn-id: http://svn.opengroupware.org/SOPE/trunk@1225 e4a50df8-12e2-0310-a44c-efbce7f8a7e3 --- sope-appserver/NGObjWeb/ChangeLog | 2 + .../NGObjWeb/SoObjects/SoProductLoader.h | 5 +- .../NGObjWeb/SoObjects/SoProductLoader.m | 53 +++++++++++-------- sope-appserver/NGObjWeb/Version | 2 +- 4 files changed, 38 insertions(+), 24 deletions(-) diff --git a/sope-appserver/NGObjWeb/ChangeLog b/sope-appserver/NGObjWeb/ChangeLog index 3d5a8fa4..d9d73f1e 100644 --- a/sope-appserver/NGObjWeb/ChangeLog +++ b/sope-appserver/NGObjWeb/ChangeLog @@ -1,5 +1,7 @@ 2006-03-12 Helge Hess + * SoObjects/SoProductLoader.m: quickfix to API (v4.5.222) + * SoObjects: added new class SoProductLoader which can be used to load SoProduct bundles for a given application (v4.5.221) diff --git a/sope-appserver/NGObjWeb/SoObjects/SoProductLoader.h b/sope-appserver/NGObjWeb/SoObjects/SoProductLoader.h index c0a3eea7..e32c389c 100644 --- a/sope-appserver/NGObjWeb/SoObjects/SoProductLoader.h +++ b/sope-appserver/NGObjWeb/SoObjects/SoProductLoader.h @@ -37,11 +37,12 @@ @interface SoProductLoader : NSObject { NSString *productDirectoryName; + NSString *fhsDirectoryName; NSArray *searchPathes; } -- (id)initWithAppName:(NSString *)_appName - majorVersion:(NSString *)_mav minorVersion:(NSString *)_miv; +- (id)initWithAppName:(NSString *)_appName fhsName:(NSString *)_fhs + majorVersion:(unsigned int)_mav minorVersion:(unsigned int)_miv; /* operations */ diff --git a/sope-appserver/NGObjWeb/SoObjects/SoProductLoader.m b/sope-appserver/NGObjWeb/SoObjects/SoProductLoader.m index 77b04c3c..4a42239e 100644 --- a/sope-appserver/NGObjWeb/SoObjects/SoProductLoader.m +++ b/sope-appserver/NGObjWeb/SoObjects/SoProductLoader.m @@ -25,23 +25,30 @@ @implementation SoProductLoader -- (id)initWithAppName:(NSString *)_appName - majorVersion:(NSString *)_mav minorVersion:(NSString *)_miv +- (id)initWithAppName:(NSString *)_appName fhsName:(NSString *)_fhsName + majorVersion:(unsigned int)_mav minorVersion:(unsigned int)_miv { if ((self = [super init]) != nil) { - if (![_appName isNotEmpty]) { + if (![_appName isNotEmpty] && ![_fhsName isNotEmpty]) { [self release]; return nil; } - self->productDirectoryName = - [[NSString alloc] initWithFormat:@"%@-%i.%i", _appName, _mav, _miv]; + if ([_appName isNotEmpty]) { + self->productDirectoryName = + [[NSString alloc] initWithFormat:@"%@-%i.%i", _appName, _mav, _miv]; + } + if ([_fhsName isNotEmpty]) { + self->fhsDirectoryName = + [[NSString alloc] initWithFormat:@"%@-%i.%i", _fhsName, _mav, _miv]; + } } return self; } - (void)dealloc { [self->productDirectoryName release]; + [self->fhsDirectoryName release]; [self->searchPathes release]; [super dealloc]; } @@ -58,7 +65,7 @@ NSEnumerator *e; e = [tmp objectEnumerator]; - while ((tmp = [e nextObject])) { + while ((tmp = [e nextObject]) != nil) { tmp = [tmp stringByAppendingPathComponent:self->productDirectoryName]; if (![ma containsObject:tmp]) [ma addObject:tmp]; @@ -95,36 +102,40 @@ - (void)_addFHSPathesToArray:(NSMutableArray *)ma { NSString *s; - s = [self->productDirectoryName lowercaseString]; + s = self->fhsDirectoryName; [ma addObject:[@"/usr/local/lib/" stringByAppendingString:s]]; [ma addObject:[@"/usr/lib/" stringByAppendingString:s]]; } - (NSArray *)productSearchPathes { NSMutableArray *ma; - BOOL hasGNUstepEnv; if (self->searchPathes != nil) return self->searchPathes; - - hasGNUstepEnv = [[[[NSProcessInfo processInfo] environment] - objectForKey:@"GNUSTEP_USER_ROOT"] length] > 0 ? YES : NO; - - ma = [NSMutableArray arrayWithCapacity:6]; - if (hasGNUstepEnv) - [self _addGNUstepSearchPathesToArray:ma]; + if ([self->productDirectoryName isNotEmpty]) { + BOOL hasGNUstepEnv; + + hasGNUstepEnv = [[[[NSProcessInfo processInfo] environment] + objectForKey:@"GNUSTEP_USER_ROOT"] isNotEmpty]; + + ma = [NSMutableArray arrayWithCapacity:6]; + + if (hasGNUstepEnv) + [self _addGNUstepSearchPathesToArray:ma]; #if COCOA_Foundation_LIBRARY - else - [self _addCocoaSearchPathesToArray:ma]; + else + [self _addCocoaSearchPathesToArray:ma]; #endif - - [self _addFHSPathesToArray:ma]; + } + + if ([self->fhsDirectoryName isNotEmpty]) + [self _addFHSPathesToArray:ma]; self->searchPathes = [ma copy]; - if ([self->searchPathes count] == 0) { - [self logWithFormat:@"%s: no search pathes were found !", + if (![self->searchPathes isNotEmpty]) { + [self logWithFormat:@"no search pathes were found !", __PRETTY_FUNCTION__]; } diff --git a/sope-appserver/NGObjWeb/Version b/sope-appserver/NGObjWeb/Version index 125b313c..9b6f14d6 100644 --- a/sope-appserver/NGObjWeb/Version +++ b/sope-appserver/NGObjWeb/Version @@ -1,6 +1,6 @@ # version file -SUBMINOR_VERSION:=221 +SUBMINOR_VERSION:=222 # v4.5.214 requires libNGExtensions v4.5.179 # v4.5.122 requires libNGExtensions v4.5.153 -- 2.39.5