Minor fixup for when user's Library directory does not exist.

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@21872 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
Richard Frith-Macdonald 2005-10-25 13:53:29 +00:00
parent ef3a555cd6
commit 7c41f22c15
2 changed files with 16 additions and 3 deletions

View file

@ -1,3 +1,8 @@
2005-10-25 Richard Frith-Macdonald <rfm@gnu.org>
* Source/NSColorList.m: ([writeTofile:]) return NO if there is no
known directory to write to.
2005-10-23 Richard Frith-Macdonald <rfm@gnu.org>
* Source/NSWindow.m: ([setExcludedFromWindowsMenu:]) when a window

View file

@ -443,9 +443,17 @@ static NSLock *_gnustep_color_list_lock = nil;
if (path == nil || ([fm fileExistsAtPath: path isDirectory: &isDir] == NO))
{
NSArray *paths;
// FIXME the standard path for saving color lists?
path = [[NSSearchPathForDirectoriesInDomains(NSLibraryDirectory,
NSUserDomainMask, YES) objectAtIndex: 0]
paths = NSSearchPathForDirectoriesInDomains(NSLibraryDirectory,
NSUserDomainMask, YES);
if ([paths count] == 0)
{
NSLog (@"Failed to find Library directory for user");
return NO; // No directory to save to.
}
path = [[paths objectAtIndex: 0]
stringByAppendingPathComponent: @"Colors"];
isDir = YES;
}
@ -496,7 +504,7 @@ static NSLock *_gnustep_color_list_lock = nil;
}
else
{
NSLog (@"Failed attemp to create directory %@", path);
NSLog (@"Failed attempt to create directory %@", path);
}
}