add option to display devpath and another way to guess it

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@37593 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
Richard Frith-MacDonald 2014-01-13 15:15:51 +00:00
parent b426fe64a9
commit afd37cae6c
2 changed files with 29 additions and 5 deletions

View file

@ -63,6 +63,7 @@
#import "Foundation/NSPathUtilities.h"
#import "Foundation/NSException.h"
#import "Foundation/NSArray.h"
#import "Foundation/NSBundle.h"
#import "Foundation/NSDictionary.h"
#import "Foundation/NSFileManager.h"
#import "Foundation/NSProcessInfo.h"
@ -2297,13 +2298,20 @@ if (domainMask & mask) \
mgr = [NSFileManager defaultManager];
/* First see if we can find the developer root above the sytem
* tools directory of the current running process.
/* First see if we can find the developer root above the
* system tools directory of the current running process.
*/
path = devroot(mgr, gnustepSystemTools);
/* If we havent found the developer area relative to the current
* process, look for the GNUstep package installation root.
/* Failing that, try looking above the base library.
*/
path = devroot(mgr,
[[NSBundle bundleForLibrary: @"gnustep-base"] bundlePath]);
/* If we havent found the developer area relative to the
* hierarchy used by the current process, look for the
* GNUstep package installation root in case we have the
* developer environment installed from a package.
*/
if (nil == path)
{

View file

@ -36,6 +36,9 @@
<deflist>
<term>defaults</term>
<desc>The GNUstep defaults directory of the current user</desc>
<term>devpath</term>
<desc>A path specification which may be used to add the root(s) of
the GNUstep development environment on the current system.</desc>
<term>libpath</term>
<desc>A path specification which may be used to add all the standard
GNUstep directories where dynamic libraries are normally stored.<br />
@ -96,6 +99,16 @@ main(int argc, char** argv, char **env)
path = [directories componentsJoinedByString: sep];
GSPrintf(stdout, @"%@", path);
}
else if ([name isEqualToString: @"devpath"] == YES)
{
NSArray *directories;
NSString *path;
directories = NSSearchPathForDirectoriesInDomains
(NSDeveloperDirectory, NSAllDomainsMask, YES);
path = [directories componentsJoinedByString: sep];
GSPrintf(stdout, @"%@", path);
}
else if ([name isEqualToString: @"libpath"] == YES)
{
NSArray *directories;
@ -128,7 +141,10 @@ main(int argc, char** argv, char **env)
@"to be printed.\n\n"
@"The arguments and their meanings are -\n\n"
@"defaults\n"
@" The GNUstep defaults directory of the current user\n\n"
@" The GNUstep defaults directory of the current user.\n\n"
@"devpath\n"
@" A path specification which may be used to add the root(s) of\n"
@" the GNUstep development environment on the current system.\n\n"
@"libpath\n"
@" A path specification which may be used to add all the standard GNUstep\n"
@" directories where dynamic libraries are normally stored.\n\n"