From 33de2cc6296ba484ae57e042689eb16b06de31df Mon Sep 17 00:00:00 2001 From: helge Date: Fri, 12 Nov 2004 21:48:17 +0000 Subject: [PATCH] fixed OGo bug #979 git-svn-id: http://svn.opengroupware.org/SOPE/trunk@366 e4a50df8-12e2-0310-a44c-efbce7f8a7e3 --- sope-ical/NGiCal/common.h | 5 +- sope-xml/SaxObjC/ChangeLog | 9 ++ sope-xml/SaxObjC/SaxXMLReaderFactory.m | 120 ++++++++++++++++++------- sope-xml/SaxObjC/Version | 2 +- 4 files changed, 99 insertions(+), 37 deletions(-) diff --git a/sope-ical/NGiCal/common.h b/sope-ical/NGiCal/common.h index 3c451451..a8e6f2b9 100644 --- a/sope-ical/NGiCal/common.h +++ b/sope-ical/NGiCal/common.h @@ -1,7 +1,7 @@ /* - Copyright (C) 2000-2003 SKYRIX Software AG + Copyright (C) 2000-2004 SKYRIX Software AG - This file is part of OGo + This file is part of OpenGroupware.org. OGo is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the @@ -18,7 +18,6 @@ Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -// $Id$ #ifndef __ICal_common_H__ #define __ICal_common_H__ diff --git a/sope-xml/SaxObjC/ChangeLog b/sope-xml/SaxObjC/ChangeLog index b3698c76..3dd60c5d 100644 --- a/sope-xml/SaxObjC/ChangeLog +++ b/sope-xml/SaxObjC/ChangeLog @@ -1,3 +1,12 @@ +2004-11-12 Max Berger + + * SaxXMLReaderFactory.m: fixed SaxDriver lookup for gstep-base on + MingW32 (OGo bug #979) (v4.5.47) + +2004-11-12 Helge Hess + + * SaxXMLReaderFactory.m: cleanup of driver path processing (v4.5.46) + 2004-11-07 Marcus Mueller * SaxObjC.xcode: added SOPE_MAJOR/MINOR definitions for the build diff --git a/sope-xml/SaxObjC/SaxXMLReaderFactory.m b/sope-xml/SaxObjC/SaxXMLReaderFactory.m index 455ef56a..f3d2ea97 100644 --- a/sope-xml/SaxObjC/SaxXMLReaderFactory.m +++ b/sope-xml/SaxObjC/SaxXMLReaderFactory.m @@ -64,19 +64,25 @@ static id factory = nil; [self->mimeTypeToName release]; self->mimeTypeToName = nil; } -- (NSArray *)saxReaderSearchPathes { - NSMutableArray *ma; - id tmp; -#if !COCOA_Foundation_LIBRARY - NSDictionary *env; +/* search path construction */ + +- (BOOL)searchFrameworkBundle { +#if COMPILE_AS_FRAMEWORK + return YES; +#else + return NO; #endif +} - if (searchPathes) - return searchPathes; - - ma = [NSMutableArray arrayWithCapacity:8]; +- (NSString *)libraryDriversSubDir { + return [NSString stringWithFormat:@"SaxDrivers-%i.%i", + SOPE_MAJOR_VERSION, SOPE_MINOR_VERSION]; +} -#if COCOA_Foundation_LIBRARY +- (void)addSearchPathesForCocoa:(NSMutableArray *)ma { + /* for Cocoa */ + id tmp; + tmp = NSSearchPathForDirectoriesInDomains(NSAllLibrariesDirectory, NSAllDomainsMask, YES); @@ -84,9 +90,7 @@ static id factory = nil; NSEnumerator *e; NSString *subdir; - subdir = [NSString stringWithFormat:@"SaxDrivers-%i.%i", - SOPE_MAJOR_VERSION, SOPE_MINOR_VERSION]; - + subdir = [self libraryDriversSubDir]; e = [tmp objectEnumerator]; while ((tmp = [e nextObject]) != nil) { tmp = [tmp stringByAppendingPathComponent:subdir]; @@ -94,35 +98,83 @@ static id factory = nil; [ma addObject:tmp]; } } -#if COMPILE_AS_FRAMEWORK - { - NSBundle *fwBundle; + if ([self searchFrameworkBundle]) { + NSBundle *fwBundle; - /* no need to add 4.5 here, right? */ - fwBundle = [NSBundle bundleForClass:[self class]]; - [ma addObject:[[fwBundle resourcePath] - stringByAppendingPathComponent:@"SaxDrivers"]]; + /* no need to add 4.5 here, right? */ + fwBundle = [NSBundle bundleForClass:[self class]]; + tmp = [[fwBundle resourcePath] stringByAppendingPathComponent: + @"SaxDrivers"]; + [ma addObject:tmp]; } -#endif +} + +- (void)addSearchPathesForStdLibPathes:(NSMutableArray *)ma { + /* for gstep-base */ + NSEnumerator *e; + NSString *subdir; + id tmp; + +#if !COCOA_Foundation_LIBRARY + tmp = NSStandardLibraryPaths(); #else + tmp = nil; /* not available on Cocoa? */ +#endif + if ([tmp count] == 0) + return; + + subdir = [self libraryDriversSubDir]; + e = [tmp objectEnumerator]; + while ((tmp = [e nextObject]) != nil) { + tmp = [tmp stringByAppendingPathComponent:subdir]; + if ([ma containsObject:tmp]) + continue; + + [ma addObject:tmp]; + } +} + +- (void)addSearchPathesForGNUstepEnv:(NSMutableArray *)ma { + /* for libFoundation */ + NSDictionary *env; + NSEnumerator *e; + NSString *subdir; + id tmp; + env = [[NSProcessInfo processInfo] environment]; if ((tmp = [env objectForKey:@"GNUSTEP_PATHPREFIX_LIST"]) == nil) tmp = [env objectForKey:@"GNUSTEP_PATHLIST"]; tmp = [tmp componentsSeparatedByString:@":"]; - if ([tmp count] > 0) { - NSEnumerator *e; - NSString *subdir; + if ([tmp count] == 0) + return; + + subdir = [@"Library/" stringByAppendingString:[self libraryDriversSubDir]]; + e = [tmp objectEnumerator]; + while ((tmp = [e nextObject]) != nil) { + tmp = [tmp stringByAppendingPathComponent:subdir]; + if ([ma containsObject:tmp]) + continue; - subdir = [NSString stringWithFormat:@"Library/SaxDrivers-%i.%i", - SOPE_MAJOR_VERSION, SOPE_MINOR_VERSION]; - e = [tmp objectEnumerator]; - while ((tmp = [e nextObject]) != nil) { - tmp = [tmp stringByAppendingPathComponent:subdir]; - if (![ma containsObject:tmp]) - [ma addObject:tmp]; - } + [ma addObject:tmp]; } +} + +- (NSArray *)saxReaderSearchPathes { + NSMutableArray *ma; + id tmp; + + if (searchPathes != nil) + return searchPathes; + + ma = [NSMutableArray arrayWithCapacity:8]; + +#if COCOA_Foundation_LIBRARY + [self addSearchPathesForCocoa:ma]; +#elif GNUSTEP_BASE_LIBRARY + [self addSearchPathesForStdLibPathes:ma]; +#else + [self addSearchPathesForGNUstepEnv:ma]; #endif /* FHS fallback */ @@ -138,6 +190,8 @@ static id factory = nil; return searchPathes; } +/* loading */ + - (void)_loadBundlePath:(NSString *)_bundlePath infoDictionary:(NSDictionary *)_info nameMap:(NSMutableDictionary *)_nameMap @@ -164,7 +218,7 @@ static id factory = nil; /* found a driver with valid info dict, process it ... */ e = [drivers objectEnumerator]; - while ((driverInfo = [e nextObject])) { + while ((driverInfo = [e nextObject]) != nil) { NSString *name, *tname; NSEnumerator *te; diff --git a/sope-xml/SaxObjC/Version b/sope-xml/SaxObjC/Version index 22e2df1f..25b5b300 100644 --- a/sope-xml/SaxObjC/Version +++ b/sope-xml/SaxObjC/Version @@ -1,3 +1,3 @@ # version file -SUBMINOR_VERSION:=45 +SUBMINOR_VERSION:=47 -- 2.39.5