From afd37cae6c6833485a632d33b4f377e4df8027fe Mon Sep 17 00:00:00 2001 From: Richard Frith-MacDonald Date: Mon, 13 Jan 2014 15:15:51 +0000 Subject: [PATCH] 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 --- Source/NSPathUtilities.m | 16 ++++++++++++---- Tools/gspath.m | 18 +++++++++++++++++- 2 files changed, 29 insertions(+), 5 deletions(-) diff --git a/Source/NSPathUtilities.m b/Source/NSPathUtilities.m index 0275e503d..6ffe4a64d 100644 --- a/Source/NSPathUtilities.m +++ b/Source/NSPathUtilities.m @@ -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) { diff --git a/Tools/gspath.m b/Tools/gspath.m index 2fcc7914b..5b4ba5365 100644 --- a/Tools/gspath.m +++ b/Tools/gspath.m @@ -36,6 +36,9 @@ defaults The GNUstep defaults directory of the current user + devpath + A path specification which may be used to add the root(s) of + the GNUstep development environment on the current system. libpath A path specification which may be used to add all the standard GNUstep directories where dynamic libraries are normally stored.
@@ -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"