Make the services filesystem lookup code a bit more robust

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@24786 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
Nicola Pero 2007-03-06 18:22:14 +00:00
parent 88269d6c0d
commit 650349f4e3
2 changed files with 22 additions and 3 deletions

View file

@ -1,3 +1,9 @@
2007-03-06 Nicola Pero <nicola.pero@meta-innovation.com>
* Source/GSServicesManager.m ([+newWithApplication:]): If the base
library returns an empty User Library path, try using a default
one.
2007-03-06 Fred Kiefer <FredKiefer@gmx.de>
* Source/NSBox.m (-initWithFrame:): Set content view via the

View file

@ -508,7 +508,8 @@ static NSString *disabledName = @".GNUstepDisabled";
+ (GSServicesManager*) newWithApplication: (NSApplication*)app
{
NSString *str;
NSString *path;
NSArray *paths;
NSString *path = nil;
if (manager != nil)
{
@ -521,8 +522,20 @@ static NSString *disabledName = @".GNUstepDisabled";
manager = [GSServicesManager alloc];
str = [NSSearchPathForDirectoriesInDomains(NSLibraryDirectory,
NSUserDomainMask, YES) objectAtIndex: 0];
paths = NSSearchPathForDirectoriesInDomains(NSLibraryDirectory,
NSUserDomainMask, YES);
if ((paths != nil) && ([paths count] > 0))
{
str = [paths objectAtIndex: 0];
}
/*
* If standard search paths are not set up, try a default location.
*/
if (str == nil)
{
str = [[NSHomeDirectory() stringByAppendingPathComponent:
@"GNUstep"] stringByAppendingPathComponent: @"Library"];
}
str = [str stringByAppendingPathComponent: @"Services"];
path = [str stringByAppendingPathComponent: servicesName];
manager->_servicesPath = [path copy];