Add more checks/warnings

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@22127 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
Richard Frith-Macdonald 2005-12-01 09:33:22 +00:00
parent 57e466d642
commit 21fa587569
2 changed files with 44 additions and 2 deletions

View file

@ -1,3 +1,8 @@
2005-12-01 Richard Frith-Macdonald <rfm@gnu.org>
* Source/NSpathUtilities.m: Add more checks/warnings about improper
configuration.
2005-11-28 Richard Frith-Macdonald <rfm@gnu.org>
* Headers/Additions/GNUstepBase/GSConfig.h.in:

View file

@ -254,6 +254,8 @@ getPathConfig(NSDictionary *dict, NSString *key)
{
path = [NSString stringWithFormat: @"%c:%@", (char)buf[1],
[path substringFromindex: 2]];
path = [path stringByReplacingString: @"/"
withString: @"\\"];
NSLog(@"I am guessing that you meant '%@'", path);
}
}
@ -397,6 +399,7 @@ GNUstepConfig(NSDictionary *newConfig)
if (newConfig == nil)
{
NSString *file = nil;
BOOL fromEnvironment = YES;
conf = [[NSMutableDictionary alloc] initWithCapacity: 32];
@ -407,6 +410,7 @@ GNUstepConfig(NSDictionary *newConfig)
#endif
if (file == nil)
{
fromEnvironment = NO;
file = [NSString stringWithCString:
STRINGIFY(GNUSTEP_CONFIG_FILE)];
}
@ -428,8 +432,41 @@ GNUstepConfig(NSDictionary *newConfig)
// Join the two together
file = [path stringByAppendingPathComponent: file];
}
gnustepConfigPath = [file stringByDeletingLastPathComponent];
RETAIN(gnustepConfigPath);
if ([file isAbsolutePath] == NO)
{
if (fromEnvironment == YES)
{
NSLog(@"GNUSTEP_CONFIG_FILE value ('%@') is not "
@"an absolute path. Please fix the environment "
@"variable.", file);
}
else
{
NSLog(@"GNUSTEP_CONFIG_FILE value ('%@') is not "
@"an absolute path. Please rebuild GNUstep-base "
@"specifying a valid path to the config file.", file);
}
#if defined(__MINGW32_)
if ([file length] > 2)
{
unichar buf[3];
[file getCharacters: buf range: NSMakeRange(0, 3)];
if ((buf[0] == '/' || bug[0] == '\\') && isalpha(buf[1])
&& (buf[2] == '/' || bug[2] == '\\'))
{
file = [NSString stringWithFormat: @"%c:%@",
(char)buf[1], [file substringFromindex: 2]];
file = [file stringByReplacingString: @"/"
withString: @"\\"];
NSLog(@"I am guessing that you meant '%@'", file);
}
}
#endif
}
gnustepConfigPath
= RETAIN([file stringByDeletingLastPathComponent]);
ParseConfigurationFile(file, conf);
}
else