Index: sope-xml/libxmlSAXDriver/GNUmakefile =================================================================== --- sope-xml/libxmlSAXDriver/GNUmakefile (revision 1557) +++ sope-xml/libxmlSAXDriver/GNUmakefile (working copy) @@ -7,7 +7,7 @@ BUNDLE_NAME = libxmlSAXDriver BUNDLE_EXTENSION = .sax -BUNDLE_INSTALL_DIR = $(GNUSTEP_INSTALLATION_DIR)/Library/SaxDrivers-$(MAJOR_VERSION).$(MINOR_VERSION)/ +BUNDLE_INSTALL_DIR = $(GNUSTEP_LIBRARY)/SaxDrivers-$(MAJOR_VERSION).$(MINOR_VERSION)/ libxmlSAXDriver_PCH_FILE = common.h Index: sope-xml/STXSaxDriver/GNUmakefile =================================================================== --- sope-xml/STXSaxDriver/GNUmakefile (revision 1557) +++ sope-xml/STXSaxDriver/GNUmakefile (working copy) @@ -7,7 +7,7 @@ BUNDLE_NAME = STXSaxDriver BUNDLE_EXTENSION = .sax -BUNDLE_INSTALL_DIR = $(GNUSTEP_INSTALLATION_DIR)/Library/SaxDrivers-$(SOPE_MAJOR_VERSION).$(SOPE_MINOR_VERSION)/ +BUNDLE_INSTALL_DIR = $(GNUSTEP_LIBRARY)/SaxDrivers-$(SOPE_MAJOR_VERSION).$(SOPE_MINOR_VERSION)/ STXSaxDriver_PCH_FILE = common.h Index: sope-core/NGExtensions/NGExtensions/NGResourceLocator.h =================================================================== --- sope-core/NGExtensions/NGExtensions/NGResourceLocator.h (revision 1557) +++ sope-core/NGExtensions/NGExtensions/NGResourceLocator.h (working copy) @@ -52,23 +52,54 @@ int reserved:29; } flags; } - +/* The 'GNUstepPath' is a string describing the required path. This + * is the relative location of the path in a standard GNUstep + * hierarchy when a standard GNUstep hierarchy is being used; but if + * gnustep-base (which supports arbitrary filesystem layouts) is being + * used, the path is heuristically mapped to the standard paths + * accepted by NSSearchPathForDirectoriesInDomains using the following + * logic: + * + * "Library/WebApplications" --> GSWebApplicationsDirectory + * "Library/Libraries" --> GSLibrariesDirectory + * "Tools" --> GSToolsDirectory + * "Tools/Admin" --> GSAdminToolsDirectory + * "Applications" --> GSApplicationsDirectory + * "Applications/Admin" --> GSAdminApplicationsDirectory + * "Library/xxx" --> NSLibraryDirectory/xxx + * "yyy" --> NSLibraryDirectory/yyy + * + * In the last two cases 'xxx' and 'yyy' are arbitrary strings/paths + * that don't match anything else. Eg, if you create an + * NGResourceLocators to look up files in "Library/Resources" you will + * get one that looks them up in NSLibraryDirectory/Resources (which + * means a list of directories containing + * GNUSTEP_USER_LIBRARY/Resources, GNUSTEP_LOCAL_LIBRARY/Resources, + * GNUSTEP_NETWORK_LIBRARY/Resources, + * GNUSTEP_SYSTEM_LIBRARY/Resources). + */ + (id)resourceLocatorForGNUstepPath:(NSString *)_path fhsPath:(NSString *)_fhs; - (id)initWithGNUstepPath:(NSString *)_path fhsPath:(NSString *)_fhs; /* resource pathes */ +/* It's not a good idea to access these directly if you want portable + * code. More logical to use directly the 'operations' lookup methods + * below which encapsulate all the internal filesystem details. + */ - (NSArray *)gsRootPathes; /* GNUSTEP_PATHPREFIX_LIST or MacOSX */ - (NSArray *)fhsRootPathes; - (NSArray *)searchPathes; /* operations */ +/* These are public and work across all types of filesystems, it's how you find resources. */ - (NSString *)lookupFileWithName:(NSString *)_name; - (NSString *)lookupFileWithName:(NSString *)_name extension:(NSString *)_ext; - (NSArray *)lookupAllFilesWithExtension:(NSString *)_ext doReturnFullPath:(BOOL)_withPath; +/* End public */ @end Index: sope-core/NGExtensions/NGBundleManager.m =================================================================== --- sope-core/NGExtensions/NGBundleManager.m (revision 1557) +++ sope-core/NGExtensions/NGBundleManager.m (working copy) @@ -334,8 +334,7 @@ - (void)_addGNUstepPathsToPathArray:(NSMutableArray *)_paths { #if !GNUSTEP #else - // TODO: whats that supposed to do? - // TODO: replace with proper path locator function! + /* Old code for old gstep-make and gstep-base. */ NSDictionary *env; NSString *p; unsigned i, count; @@ -355,6 +354,19 @@ if (p) [self->bundleSearchPaths addObject:p]; } + + /* New code for new gstep-make and gstep-base. */ + tmp = NSStandardLibraryPaths(); + { + NSEnumerator *e = [tmp objectEnumerator]; + while ((tmp = [e nextObject]) != nil) { + tmp = [tmp stringByAppendingPathComponent:@"Bundles"]; + if ([self->bundleSearchPaths containsObject:tmp]) + continue; + + [self->bundleSearchPaths addObject:tmp]; + } + } #endif } Index: sope-core/NGExtensions/NGResourceLocator.m =================================================================== --- sope-core/NGExtensions/NGResourceLocator.m (revision 1557) +++ sope-core/NGExtensions/NGResourceLocator.m (working copy) @@ -87,25 +87,99 @@ return pathes; } +- (NSArray *)standardSearchPathsForGNUstepPath: (NSString *)gsPath +{ + if ([gsPath isEqualToString: @"Library/WebApplications"]) { + return NSSearchPathForDirectoriesInDomains (GSWebApplicationsDirectory, + NSAllDomainsMask, YES); + } + else if ([gsPath isEqualToString: @"Library/Libraries"]) { + return NSSearchPathForDirectoriesInDomains (GSLibrariesDirectory, + NSAllDomainsMask, YES); + } + else if ([gsPath isEqualToString: @"Library"]) { + return NSSearchPathForDirectoriesInDomains (NSLibraryDirectory, + NSAllDomainsMask, YES); + } + else if ([gsPath isEqualToString: @"Tools"]) { + return NSSearchPathForDirectoriesInDomains (GSToolsDirectory, + NSAllDomainsMask, YES); + } + else if ([gsPath isEqualToString: @"Tools/Admin"]) { + return NSSearchPathForDirectoriesInDomains (GSAdminToolsDirectory, + NSAllDomainsMask, YES); + } + else if ([gsPath isEqualToString: @"Applications"]) { + return NSSearchPathForDirectoriesInDomains (NSApplicationDirectory, + NSAllDomainsMask, YES); + } + else if ([gsPath isEqualToString: @"Applications/Admin"]) { + return NSSearchPathForDirectoriesInDomains (NSAdminApplicationDirectory, + NSAllDomainsMask, YES); + } + else { + /* Assume they're looking for some subdirectory of 'Library/'. */ + + /* Remove the initial 'Library/' if any. Note that 'Library/' + * is 8 characters. + */ + if ([gsPath hasPrefix: @"Library/"]) + gsPath = [gsPath substringFromIndex: 8]; + + /* Now retrieve the NSLibraryDirectory array and append gsPath + * to all paths. + */ + { + NSArray *libraryPaths = NSSearchPathForDirectoriesInDomains (NSLibraryDirectory, + NSAllDomainsMask, YES); + NSMutableArray *paths = [libraryPaths mutableCopy]; + int count, i; + + AUTORELEASE(paths); + count = [paths count]; + for (i = 0; i < count; i++) { + [paths replaceObjectAtIndex: i + withObject: [[paths objectAtIndex: i] stringByAppendingPathComponent: gsPath]]; + } + return paths; + } + } +} + - (NSArray *)collectSearchPathes { NSMutableArray *ma; NSEnumerator *e; NSString *p; ma = [NSMutableArray arrayWithCapacity:6]; - - e = ([self->gsSubPath length] > 0) - ? [[self gsRootPathes] objectEnumerator] - : (NSEnumerator *)nil; - while ((p = [e nextObject]) != nil) { - p = [p stringByAppendingPathComponent:self->gsSubPath]; - if ([ma containsObject:p]) - continue; + + if ([self->gsSubPath length] > 0) { - if (![self->fileManager fileExistsAtPath:p]) - continue; +#if GNUSTEP_BASE_LIBRARY + e = [[self standardSearchPathsForGNUstepPath: self->gsSubPath] objectEnumerator]; + while ((p = [e nextObject]) != nil) { + if ([ma containsObject:p]) + continue; + + if (![self->fileManager fileExistsAtPath:p]) + continue; + + [ma addObject:p]; + } +#endif - [ma addObject:p]; + /* Old hack using GNUSTEP_PATHLIST. Should be removed at some point. */ + e = [[self gsRootPathes] objectEnumerator]; + while ((p = [e nextObject]) != nil) { + p = [p stringByAppendingPathComponent:self->gsSubPath]; + if ([ma containsObject:p]) + continue; + + if (![self->fileManager fileExistsAtPath:p]) + continue; + + [ma addObject:p]; + } } e = ([self->fhsSubPath length] > 0) @@ -160,7 +234,7 @@ return nil; if ((p = [self->nameToPathCache objectForKey:_name]) != nil) return [p isNotNull] ? p : (NSString *)nil; - + e = [[self searchPathes] objectEnumerator]; while ((p = [e nextObject]) != nil) { p = [p stringByAppendingPathComponent:_name]; Index: sope-core/common.make =================================================================== --- sope-core/common.make (revision 1557) +++ sope-core/common.make (working copy) @@ -6,8 +6,6 @@ include $(SKYROOT)/Version -include ./Version -GNUSTEP_INSTALLATION_DIR = $(GNUSTEP_LOCAL_ROOT) - ADDITIONAL_CPPFLAGS += -pipe -Wall -Wno-protocol ifeq ($(reentrant),yes) ADDITIONAL_CPPFLAGS += -D_REENTRANT=1