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/NSPathUtilities.h"
#import "Foundation/NSException.h" #import "Foundation/NSException.h"
#import "Foundation/NSArray.h" #import "Foundation/NSArray.h"
#import "Foundation/NSBundle.h"
#import "Foundation/NSDictionary.h" #import "Foundation/NSDictionary.h"
#import "Foundation/NSFileManager.h" #import "Foundation/NSFileManager.h"
#import "Foundation/NSProcessInfo.h" #import "Foundation/NSProcessInfo.h"
@ -2297,13 +2298,20 @@ if (domainMask & mask) \
mgr = [NSFileManager defaultManager]; mgr = [NSFileManager defaultManager];
/* First see if we can find the developer root above the sytem /* First see if we can find the developer root above the
* tools directory of the current running process. * system tools directory of the current running process.
*/ */
path = devroot(mgr, gnustepSystemTools); path = devroot(mgr, gnustepSystemTools);
/* If we havent found the developer area relative to the current /* Failing that, try looking above the base library.
* process, look for the GNUstep package installation root. */
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) if (nil == path)
{ {

View file

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