From 6979f0d2fea3617efcbece66a00d44eb367d403d Mon Sep 17 00:00:00 2001 From: CaS Date: Sun, 31 Jul 2005 08:18:19 +0000 Subject: [PATCH] Bugfix for returning paths on a non-flattened system. git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@21577 72102866-910b-0410-8b05-ffd578937521 --- ChangeLog | 10 ++++++ Source/GNUmakefile | 2 ++ Source/NSPathUtilities.m | 72 ++++++++++++++++++++++++++++++++++++++++ 3 files changed, 84 insertions(+) diff --git a/ChangeLog b/ChangeLog index db123bbee..461fd106a 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,13 @@ +2005-07-31 Richard Frith-Macdonald + + * Source/GNUmakefile: Pass GNUSTEP_FLATTENED as preprocessor + definitions when building. + * Source/NSPathUtilities.m: Use GNUSTEP_FLATTENED and other + definitions to fix bug in returning paths for non-flattened + systems (code was previously returneing flattened paths + irrespective of whether the system was configured flattened + or not). + 2005-07-30 Jeremy Bettis * Source/NSData.m: Support write to file for windows9x users. diff --git a/Source/GNUmakefile b/Source/GNUmakefile index 9302c9859..2e7a21361 100644 --- a/Source/GNUmakefile +++ b/Source/GNUmakefile @@ -73,6 +73,7 @@ DEFS= -DGNUSTEP_INSTALL_PREFIX=$(GNUSTEP_TARGET_INSTALL_PREFIX) \ -DGNUSTEP_TARGET_DIR=\"$(GNUSTEP_TARGET_DIR)\" \ -DGNUSTEP_TARGET_CPU=\"$(GNUSTEP_TARGET_CPU)\" \ -DGNUSTEP_TARGET_OS=\"$(GNUSTEP_TARGET_OS)\" \ + -DGNUSTEP_FLATTENED=\"$(GNUSTEP_FLATTENED)\" \ -DLIBRARY_COMBO=\"$(LIBRARY_COMBO)\" @@ -85,6 +86,7 @@ DEFS= -DGNUSTEP_INSTALL_PREFIX=$(GNUSTEP_INSTALL_PREFIX) \ -DGNUSTEP_TARGET_DIR=\"$(GNUSTEP_TARGET_DIR)\" \ -DGNUSTEP_TARGET_CPU=\"$(GNUSTEP_TARGET_CPU)\" \ -DGNUSTEP_TARGET_OS=\"$(GNUSTEP_TARGET_OS)\" \ + -DGNUSTEP_FLATTENED=\"$(GNUSTEP_FLATTENED)\" \ -DLIBRARY_COMBO=\"$(LIBRARY_COMBO)\" endif diff --git a/Source/NSPathUtilities.m b/Source/NSPathUtilities.m index b7763353e..1c5a4b42b 100644 --- a/Source/NSPathUtilities.m +++ b/Source/NSPathUtilities.m @@ -112,6 +112,31 @@ #define DEFAULT_USER_ROOT @"GNUstep" +static NSString *gnustep_target_cpu = +#ifdef GNUSTEP_TARGET_CPU + @GNUSTEP_TARGET_CPU; +#else + nil; +#endif +static NSString *gnustep_target_os = +#ifdef GNUSTEP_TARGET_OS + @GNUSTEP_TARGET_OS; +#else + nil; +#endif +static NSString *library_combo = +#ifdef LIBRARY_COMBO + @LIBRARY_COMBO; +#else + nil; +#endif +static NSString *gnustep_flattened = +#ifdef GNUSTEP_FLATTENED + @GNUSTEP_FLATTENED; +#else + nil; +#endif + #define MGR() [NSFileManager defaultManager] /* @@ -1390,12 +1415,35 @@ if (domainMask & mask) \ case GSLibrariesDirectory: { NSString *gslibsDir; + NSString *full = nil; + NSString *part = nil; gslibsDir = [libraryDir stringByAppendingPathComponent: libsDir]; + if ([gnustep_flattened boolValue] == NO + && gnustep_target_cpu != nil && gnustep_target_os != nil) + { + part = [gnustep_target_cpu stringByAppendingPathComponent: + gnustep_target_os]; + if (library_combo != nil) + { + full = [part stringByAppendingPathComponent: library_combo]; + full = [gslibsDir stringByAppendingPathComponent: full]; + } + part = [gslibsDir stringByAppendingPathComponent: part]; + } + ADD_PATH(NSUserDomainMask, gnustepUserRoot, gslibsDir); + if (full) ADD_PATH(NSUserDomainMask, gnustepUserRoot, full); + if (part) ADD_PATH(NSUserDomainMask, gnustepUserRoot, part); ADD_PATH(NSLocalDomainMask, gnustepLocalRoot, gslibsDir); + if (full) ADD_PATH(NSLocalDomainMask, gnustepLocalRoot, full); + if (part) ADD_PATH(NSLocalDomainMask, gnustepLocalRoot, part); ADD_PATH(NSNetworkDomainMask, gnustepNetworkRoot, gslibsDir); + if (full) ADD_PATH(NSNetworkDomainMask, gnustepNetworkRoot, full); + if (part) ADD_PATH(NSNetworkDomainMask, gnustepNetworkRoot, part); ADD_PATH(NSSystemDomainMask, gnustepSystemRoot, gslibsDir); + if (full) ADD_PATH(NSSystemDomainMask, gnustepSystemRoot, full); + if (part) ADD_PATH(NSSystemDomainMask, gnustepSystemRoot, part); ADD_PLATFORM_PATH(NSLocalDomainMask, localLibs); ADD_PLATFORM_PATH(NSSystemDomainMask, platformLibs); @@ -1405,10 +1453,34 @@ if (domainMask & mask) \ case GSToolsDirectory: { + NSString *full = nil; + NSString *part = nil; + + if ([gnustep_flattened boolValue] == NO + && gnustep_target_cpu != nil && gnustep_target_os != nil) + { + part = [gnustep_target_cpu stringByAppendingPathComponent: + gnustep_target_os]; + if (library_combo != nil) + { + full = [part stringByAppendingPathComponent: library_combo]; + full = [toolsDir stringByAppendingPathComponent: full]; + } + part = [toolsDir stringByAppendingPathComponent: part]; + } + ADD_PATH(NSUserDomainMask, gnustepUserRoot, toolsDir); + if (full) ADD_PATH(NSUserDomainMask, gnustepUserRoot, full); + if (part) ADD_PATH(NSUserDomainMask, gnustepUserRoot, part); ADD_PATH(NSLocalDomainMask, gnustepLocalRoot, toolsDir); + if (full) ADD_PATH(NSLocalDomainMask, gnustepLocalRoot, full); + if (part) ADD_PATH(NSLocalDomainMask, gnustepLocalRoot, part); ADD_PATH(NSNetworkDomainMask, gnustepNetworkRoot, toolsDir); + if (full) ADD_PATH(NSNetworkDomainMask, gnustepNetworkRoot, full); + if (part) ADD_PATH(NSNetworkDomainMask, gnustepNetworkRoot, part); ADD_PATH(NSSystemDomainMask, gnustepSystemRoot, toolsDir); + if (full) ADD_PATH(NSSystemDomainMask, gnustepSystemRoot, full); + if (part) ADD_PATH(NSSystemDomainMask, gnustepSystemRoot, part); ADD_PLATFORM_PATH(NSLocalDomainMask, localApps); ADD_PLATFORM_PATH(NSSystemDomainMask, platformApps);