fix for failure to load global defaults

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@34026 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
Richard Frith-MacDonald 2011-10-19 13:32:50 +00:00
parent cb455421ea
commit 9ff473fb71
2 changed files with 37 additions and 30 deletions

View file

@ -1,3 +1,9 @@
2011-10-19 Richard Frith-Macdonald <rfm@gnu.org>
* Source/NSPathUtilities.m
Fix failure to load global defaults when system layout/config is
locked down (problem reported by Julian Mayer).
2011-10-18 Richard Frith-Macdonald <rfm@gnu.org>
* standalone.conf: example configuration file for a standalone

View file

@ -751,9 +751,12 @@ GNUstepConfig(NSDictionary *newConfig)
{
if (newConfig == nil)
{
NSString *file = nil;
BOOL fromEnvironment = YES;
BOOL bareDirectory = NO;
NSString *file = nil;
NSString *path;
NSEnumerator *e;
NSString *defs;
BOOL fromEnvironment = YES;
BOOL bareDirectory = NO;
conf = [[NSMutableDictionary alloc] initWithCapacity: 32];
@ -786,8 +789,8 @@ GNUstepConfig(NSDictionary *newConfig)
|| [file hasPrefix: @"../"] == YES)
{
Class c = [NSProcessInfo class];
NSString *path = GSPrivateSymbolPath (c, 0);
path = GSPrivateSymbolPath (c, 0);
// Remove library name from path
path = [path stringByDeletingLastPathComponent];
if ([file hasPrefix: @"./"] == YES)
@ -831,46 +834,44 @@ GNUstepConfig(NSDictionary *newConfig)
}
#endif
}
if (bareDirectory == YES)
{
/* Set the directory name, but don't try to read file.
*/
gnustepConfigPath = RETAIN(file);
}
else
{
NSEnumerator *e;
NSString *defs;
NSString *path;
gnustepConfigPath
= RETAIN([file stringByDeletingLastPathComponent]);
ParseConfigurationFile(file, conf, nil);
if (nil != [conf objectForKey: @"GNUSTEP_EXTRA"])
{
NSLog(@"Warning: use of GNUSTEP_EXTRA in your GNUstep.conf file is deprecated. Please use a GlobalDefaults.plist instead.\n");
}
/* Merge in any values from property lists in the
* GlobalDefaults directory.
*/
path = [gnustepConfigPath stringByAppendingPathComponent:
@"GlobalDefaults"];
e = [[MGR() directoryContentsAtPath: path] objectEnumerator];
while ((defs = [e nextObject]) != nil)
{
if ([[defs pathExtension] isEqualToString: @"plist"])
{
defs = [path stringByAppendingPathComponent: defs];
addDefaults(defs, conf);
}
}
/* And merge in value from GloablDefaults.plist
*/
defs = [gnustepConfigPath stringByAppendingPathComponent:
@"GlobalDefaults.plist"];
addDefaults(defs, conf);
}
/* Merge in any values from property lists in the
* GlobalDefaults directory.
*/
path = [gnustepConfigPath stringByAppendingPathComponent:
@"GlobalDefaults"];
e = [[MGR() directoryContentsAtPath: path] objectEnumerator];
while ((defs = [e nextObject]) != nil)
{
if ([[defs pathExtension] isEqualToString: @"plist"])
{
defs = [path stringByAppendingPathComponent: defs];
addDefaults(defs, conf);
}
}
/* And merge in value from GlobalDefaults.plist
*/
defs = [gnustepConfigPath stringByAppendingPathComponent:
@"GlobalDefaults.plist"];
addDefaults(defs, conf);
}
else
{