Minor fix in defaults template handling

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@12724 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
CaS 2002-02-24 16:45:14 +00:00
parent a857fdc999
commit c9fecce6e0
3 changed files with 19 additions and 12 deletions

View file

@ -833,14 +833,19 @@ static NSFileManager* defaultManager = nil;
res = GetFileAttributes(cpath);
if (res == WIN32ERR)
return NO;
if (isDirectory)
{
return NO;
}
if (isDirectory != 0)
{
if (res & FILE_ATTRIBUTE_DIRECTORY)
*isDirectory = YES;
{
*isDirectory = YES;
}
else
*isDirectory = NO;
{
*isDirectory = NO;
}
}
return YES;
#else

View file

@ -527,7 +527,7 @@ userDirectory(NSString *name, BOOL defaults)
while (r.length > 0)
{
template = [template stringByAppendingFormat:
@"%@%@]", [old substringToIndex: r.location], uMarker];
@"%@%@", [old substringToIndex: r.location], uMarker];
old = [old substringFromIndex: NSMaxRange(r)];
r = [old rangeOfString: name];
}

View file

@ -599,18 +599,19 @@ static NSString *pathForUser(NSString *user)
{
if ([mgr createDirectoryAtPath: home attributes: attr] == NO)
{
NSLog(@"Directory '%@' does not exist - failed to create it.", home);
NSLog(@"Defaults home '%@' does not exist - failed to create it.",
home);
return nil;
}
else
{
NSLog(@"Directory '%@' did not exist - created it", home);
NSLog(@"Defaults home '%@' did not exist - created it", home);
isDir = YES;
}
}
if (isDir == NO)
{
NSLog(@"ERROR - '%@' is not a directory!", home);
NSLog(@"ERROR - defaults home '%@' is not a directory!", home);
return nil;
}
@ -618,18 +619,19 @@ static NSString *pathForUser(NSString *user)
{
if ([mgr createDirectoryAtPath: path attributes: attr] == NO)
{
NSLog(@"Directory '%@' does not exist - failed to create it.", path);
NSLog(@"Defaults path '%@' does not exist - failed to create it.",
path);
return nil;
}
else
{
NSLog(@"Directory '%@' did not exist - created it", path);
NSLog(@"Defaults path '%@' did not exist - created it", path);
isDir = YES;
}
}
if (isDir == NO)
{
NSLog(@"ERROR - '%@' is not a directory!", path);
NSLog(@"ERROR - Defaults path '%@' is not a directory!", path);
return nil;
}