Use GNUSTEP_PATHPREFIX_LIST if available

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@4334 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
richard 1999-06-02 07:14:45 +00:00
parent cc41617807
commit 2b27a6f620
2 changed files with 60 additions and 12 deletions

View file

@ -1,3 +1,8 @@
Wed Jun 2 8:34:00 1999 Richard Frith-Macdonald <richard@brainstorm.co.uk>
* Tools/make_services.m: Updated to use the GNUSTEP_PATHPREFIX_LIST
environment variable if it is available.
Wed Jun 2 4:10:00 1999 Richard Frith-Macdonald <richard@brainstorm.co.uk>
Added patches from jagapen@whitewater.chem.wisc.edu -

View file

@ -69,6 +69,7 @@ main(int argc, char** argv)
NSString *str;
unsigned index;
BOOL isDir;
BOOL usedPrefixes = NO;
NSMutableDictionary *fullMap;
NSDictionary *oldMap;
@ -145,6 +146,32 @@ main(int argc, char** argv)
}
roots = [NSMutableArray arrayWithCapacity: 3];
/*
* Set up an array of root paths from the prefix list if possible.
* If we managed to get any paths, we set a flag so we know not to
* get and add default values later.
*/
str = [env objectForKey: @"GNUSTEP_PATHPREFIX_LIST"];
if (str != nil && [str isEqualToString: @""] == NO)
{
NSArray *a = [str componentsSeparatedByString: @":"];
unsigned index;
for (index = 0; index < [a count]; index++)
{
str = [a objectAtIndex: index];
if ([str isEqualToString: @""] == NO)
{
if ([roots containsObject: str] == NO)
{
[roots addObject: str];
usedPrefixes = YES;
}
}
}
}
services = [NSMutableDictionary dictionaryWithCapacity: 200];
/*
@ -169,9 +196,10 @@ main(int argc, char** argv)
exit(1);
}
}
[roots addObject: usrRoot];
usrRoot = [usrRoot stringByAppendingPathComponent: @"Services"];
str = usrRoot; /* Record for adding into roots array */
usrRoot = [str stringByAppendingPathComponent: @"Services"];
if (([mgr fileExistsAtPath: usrRoot isDirectory: &isDir] && isDir) == 0)
{
if ([mgr createDirectoryAtPath: usrRoot attributes: nil] == NO)
@ -182,17 +210,32 @@ main(int argc, char** argv)
}
}
str = [env objectForKey: @"GNUSTEP_LOCAL_ROOT"];
if (str != nil)
[roots addObject: str];
else
[roots addObject: @"/usr/GNUstep/Local"];
if (usedPrefixes == NO)
{
/*
* Ensure that the user root (or default user root) is in the path.
*/
if ([roots containsObject: str] == NO)
[roots addObject: str];
str = [env objectForKey: @"GNUSTEP_SYSTEM_ROOT"];
if (str != nil)
[roots addObject: str];
else
[roots addObject: @"/usr/GNUstep"];
/*
* Ensure that the local root (or default local root) is in the path.
*/
str = [env objectForKey: @"GNUSTEP_LOCAL_ROOT"];
if (str == nil)
str = @"/usr/GNUstep/Local";
if ([roots containsObject: str] == NO)
[roots addObject: str];
/*
* Ensure that the system root (or default system root) is in the path.
*/
str = [env objectForKey: @"GNUSTEP_SYSTEM_ROOT"];
if (str == nil)
str = @"/usr/GNUstep";
if ([roots containsObject: str] == NO)
[roots addObject: str];
}
/*
* Before doing the main scan, we examine the 'Services' directory to