Allow bare "." as path name, but fix template to use "./"

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@34012 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
Richard Frith-MacDonald 2011-10-17 09:10:18 +00:00
parent e6a75007c0
commit 765e64da85
2 changed files with 28 additions and 24 deletions

View file

@ -239,8 +239,8 @@ static void ShutdownPathUtilities(void);
})
/* Grab a path from the config file, making it relative to the config
* file location if it begins with './' or '../', and checking that the
* result is an absolute path.
* file location if it is '.' or begins with './' or '../', and checking
* that the result is an absolute path.
*/
#define ASSIGN_PATH(var, dictionary, key) ({\
id val = getPathConfig(dictionary, key);\
@ -361,7 +361,11 @@ substUser(NSString *str)
static inline NSString *
getPath(NSString *path)
{
if ([path hasPrefix: @"./"] == YES)
if ([path isEqualToString: @"."] == YES)
{
path = gnustepConfigPath;
}
else if ([path hasPrefix: @"./"] == YES)
{
path = [gnustepConfigPath stringByAppendingPathComponent:
[path substringFromIndex: 2]];