mirror of
https://github.com/gnustep/libs-base.git
synced 2025-04-22 16:33:29 +00:00
New function to return GNUSTEP_SYSTEM_ROOT. SHould be used throughout.
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@11136 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
cb0707d9ef
commit
b75bfbda47
8 changed files with 550 additions and 583 deletions
16
ChangeLog
16
ChangeLog
|
@ -1,3 +1,17 @@
|
|||
2001-10-13 Adam Fedor <fedor@gnu.org>
|
||||
|
||||
* Headers/gnustep/base/NSPathUtilities.h (GSSystemRootDirectory):
|
||||
New function.
|
||||
* Source/GNUmakefile: Define GNUSTEP_LOCAL_ROOT and
|
||||
GNUSTEP_NETWORK_ROOT paths on compile line.
|
||||
* Source/NSUser.m (setupPathNames): Use compiled in paths as backup
|
||||
if environment variables not found.
|
||||
(GSStandardPathPrefixes): Make sure a non-nil result is returned.
|
||||
(GSSystemRootDirectory). Implement.
|
||||
* Source/NSDistributedNotificationCenter.m (_connect): Use it to
|
||||
find gdnc.
|
||||
* Source/NSPortNameServer.m (initialize): Use it to find gdomap.
|
||||
|
||||
2001-10-13 Richard Frith-Macdonald <rfm@gnu.org>
|
||||
|
||||
* Source/GSFFCallInvocation.m: Change #import to #include
|
||||
|
@ -105,7 +119,7 @@
|
|||
|
||||
2001-09-19 Adam Fedor <fedor@gnu.org>
|
||||
|
||||
* configure.in: But CPPFLAGS in quotes
|
||||
* configure.in: Put CPPFLAGS in quotes
|
||||
|
||||
2001-09-14 Adam Fedor <fedor@gnu.org>
|
||||
|
||||
|
|
|
@ -37,7 +37,9 @@
|
|||
* to use the defaults belonging to the new user.
|
||||
*/
|
||||
GS_EXPORT void GSSetUserName(NSString *name);
|
||||
GS_EXPORT NSArray *GSStandardPathPrefixes(void);
|
||||
|
||||
GS_EXPORT NSString *GSSystemRootDirectory(void);
|
||||
GS_EXPORT NSArray *GSStandardPathPrefixes(void);
|
||||
#endif
|
||||
GS_EXPORT NSString *NSUserName();
|
||||
GS_EXPORT NSString *NSHomeDirectory();
|
||||
|
|
|
@ -44,6 +44,8 @@ LIBRARY_NAME=libgnustep-base
|
|||
# the installing person may set it on the `make' command line.
|
||||
GNUSTEP_INSTALL_PREFIX=$(GNUSTEP_SYSTEM_ROOT)
|
||||
DEFS= -DGNUSTEP_INSTALL_PREFIX=$(GNUSTEP_INSTALL_PREFIX) \
|
||||
-DGNUSTEP_LOCAL_ROOT=$(GNUSTEP_LOCAL_ROOT) \
|
||||
-DGNUSTEP_NETWORK_ROOT=$(GNUSTEP_NETWORK_ROOT) \
|
||||
-DGNUSTEP_TARGET_DIR=\"$(GNUSTEP_TARGET_DIR)\" \
|
||||
-DGNUSTEP_TARGET_CPU=\"$(GNUSTEP_TARGET_CPU)\" \
|
||||
-DGNUSTEP_TARGET_OS=\"$(GNUSTEP_TARGET_OS)\" \
|
||||
|
|
|
@ -30,6 +30,7 @@
|
|||
#include <Foundation/NSArchiver.h>
|
||||
#include <Foundation/NSNotification.h>
|
||||
#include <Foundation/NSDate.h>
|
||||
#include <Foundation/NSPathUtilities.h>
|
||||
#include <Foundation/NSRunLoop.h>
|
||||
#include <Foundation/NSTask.h>
|
||||
#include <Foundation/NSDistributedNotificationCenter.h>
|
||||
|
@ -40,9 +41,11 @@
|
|||
* Macros to build text to start name server and to give an error
|
||||
* message about it - they include installation path information.
|
||||
*/
|
||||
#define stringify_it(X) #X
|
||||
#define make_gdnc_cmd(X) stringify_it(X) "/Tools/gdnc"
|
||||
#define make_gdnc_err(X) "check that " stringify_it(X) "/Tools/gdnc is running."
|
||||
#define MAKE_GDNC_CMD [GSSystemRootDirectory() \
|
||||
stringByAppendingPathComponent: @"Tools/gdnc"]
|
||||
#define MAKE_GDNC_ERR [NSString stringWithFormat: \
|
||||
@"check that %@/Tools/gdnc is running", \
|
||||
GSSystemRootDirectory()]
|
||||
|
||||
/*
|
||||
* Global variables for distributed notification center types.
|
||||
|
@ -343,8 +346,7 @@ static NSDistributedNotificationCenter *defCenter = nil;
|
|||
static NSString *cmd = nil;
|
||||
|
||||
if (cmd == nil)
|
||||
cmd = [NSString stringWithCString:
|
||||
make_gdnc_cmd(GNUSTEP_INSTALL_PREFIX)];
|
||||
cmd = MAKE_GDNC_CMD;
|
||||
|
||||
NSLog(@"NSDistributedNotificationCenter failed to contact GDNC server.\n");
|
||||
NSLog(@"Attempting to start GDNC process - this will take several seconds.\n");
|
||||
|
@ -364,8 +366,8 @@ NSLog(@"Connection to GDNC server established.\n");
|
|||
{
|
||||
recursion = NO;
|
||||
[NSException raise: NSInternalInconsistencyException
|
||||
format: @"unable to contact GDNC server - %s",
|
||||
make_gdnc_err(GNUSTEP_INSTALL_PREFIX)];
|
||||
format: @"unable to contact GDNC server - %@",
|
||||
MAKE_GDNC_ERR];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -37,6 +37,7 @@
|
|||
#include <Foundation/NSTask.h>
|
||||
#include <Foundation/NSDate.h>
|
||||
#include <Foundation/NSTimer.h>
|
||||
#include <Foundation/NSPathUtilities.h>
|
||||
#include <Foundation/NSPortNameServer.h>
|
||||
#include <Foundation/NSDebug.h>
|
||||
#ifdef __MINGW__
|
||||
|
@ -56,9 +57,13 @@
|
|||
* Macros to build text to start name server and to give an error
|
||||
* message about it - they include installation path information.
|
||||
*/
|
||||
#define MAKE_GDOMAP_CMD [GSSystemRootDirectory() \
|
||||
stringByAppendingPathComponent: @"Tools/gdomap"]
|
||||
#define MAKE_GDOMAP_ERR [NSString stringWithFormat: \
|
||||
@"check that %@/Tools/gdomap is running", \
|
||||
GSSystemRootDirectory()]
|
||||
|
||||
#define stringify_it(X) #X
|
||||
#define make_gdomap_cmd(X) stringify_it(X) "/Tools/gdomap"
|
||||
#define make_gdomap_err(X) "check that " stringify_it(X) "/Tools/gdomap is running and owned by root."
|
||||
#define make_gdomap_port(X) stringify_it(X)
|
||||
|
||||
/*
|
||||
|
@ -536,8 +541,7 @@ typedef enum {
|
|||
serverPort = RETAIN([NSString stringWithCString:
|
||||
make_gdomap_port(GDOMAP_PORT_OVERRIDE)]);
|
||||
#endif
|
||||
launchCmd = [NSString stringWithCString:
|
||||
make_gdomap_cmd(GNUSTEP_INSTALL_PREFIX)];
|
||||
launchCmd = MAKE_GDOMAP_CMD;
|
||||
portClass = [GSTcpPort class];
|
||||
}
|
||||
}
|
||||
|
|
|
@ -46,6 +46,8 @@
|
|||
#include <sys/types.h>
|
||||
#include <stdio.h>
|
||||
|
||||
#define stringify(X) #X
|
||||
|
||||
static NSString *theUserName = nil;
|
||||
|
||||
void
|
||||
|
@ -234,14 +236,25 @@ setupPathNames()
|
|||
* resources. Use fprintf to avoid recursive calls.
|
||||
*/
|
||||
warned = YES;
|
||||
gnustep_system_root = [NSString stringWithCString:
|
||||
stringify(GNUSTEP_INSTALL_PREFIX)];
|
||||
RETAIN(gnustep_system_root);
|
||||
fprintf (stderr,
|
||||
"Warning - GNUSTEP_SYSTEM_ROOT is not set "
|
||||
"- using /usr/GNUstep/System as a default\n");
|
||||
gnustep_system_root = @"/usr/GNUstep/System";
|
||||
"- using %s\n", [gnustep_system_root lossyCString]);
|
||||
}
|
||||
|
||||
gnustep_local_root = [env objectForKey: @"GNUSTEP_LOCAL_ROOT"];
|
||||
TEST_RETAIN (gnustep_local_root);
|
||||
if (gnustep_local_root == nil)
|
||||
{
|
||||
gnustep_local_root = [NSString stringWithCString:
|
||||
stringify(GNUSTEP_LOCAL_ROOT)];
|
||||
if ([gnustep_local_root length] == 0)
|
||||
gnustep_local_root = nil;
|
||||
else
|
||||
RETAIN(gnustep_local_root);
|
||||
}
|
||||
if (gnustep_local_root == nil)
|
||||
{
|
||||
if ([[gnustep_system_root lastPathComponent] isEqual:
|
||||
|
@ -270,6 +283,15 @@ setupPathNames()
|
|||
gnustep_network_root = [env objectForKey:
|
||||
@"GNUSTEP_NETWORK_ROOT"];
|
||||
TEST_RETAIN (gnustep_network_root);
|
||||
if (gnustep_network_root == nil)
|
||||
{
|
||||
gnustep_network_root = [NSString stringWithCString:
|
||||
stringify(GNUSTEP_NETWORK_ROOT)];
|
||||
if ([gnustep_network_root length] == 0)
|
||||
gnustep_network_root = nil;
|
||||
else
|
||||
RETAIN(gnustep_network_root);
|
||||
}
|
||||
if (gnustep_network_root == nil)
|
||||
{
|
||||
if ([[gnustep_system_root lastPathComponent] isEqual:
|
||||
|
@ -324,7 +346,28 @@ setupPathNames()
|
|||
}
|
||||
}
|
||||
|
||||
/** Returns a string containing the path to the GNUstep system
|
||||
installation directory. This function is gaurenteed to return a non-nil
|
||||
answer (unless something is seriously wrong, in which case the application
|
||||
will probably crash anyway) */
|
||||
NSString *
|
||||
GSSystemRootDirectory(void)
|
||||
{
|
||||
if (gnustep_system_root == nil)
|
||||
{
|
||||
setupPathNames();
|
||||
}
|
||||
return gnustep_system_root;
|
||||
}
|
||||
|
||||
/** Returns an array of strings which contain paths that should be in
|
||||
the standard search order for resources, etc. If the environment
|
||||
variable GNUSTEP_PATHPREFIX_LIST is set. It returns the list of
|
||||
paths set in that variable. Otherwise, it returns the user, local,
|
||||
network, and system paths, in that order This function is
|
||||
gaurenteed to return a non-nil answer (unless something is
|
||||
seriously wrong, in which case the application will probably crash
|
||||
anyway) */
|
||||
NSArray *
|
||||
GSStandardPathPrefixes(void)
|
||||
{
|
||||
|
@ -334,15 +377,21 @@ GSStandardPathPrefixes(void)
|
|||
|
||||
env = [[NSProcessInfo processInfo] environment];
|
||||
prefixes = [env objectForKey: @"GNUSTEP_PATHPREFIX_LIST"];
|
||||
if (prefixes != 0)
|
||||
if (prefixes != nil)
|
||||
{
|
||||
#if defined(__WIN32__)
|
||||
prefixArray = [prefixes componentsSeparatedByString: @";"];
|
||||
#else
|
||||
prefixArray = [prefixes componentsSeparatedByString: @":"];
|
||||
#endif
|
||||
if ([prefixArray count] <= 1)
|
||||
{
|
||||
/* This probably means there was some parsing error, but who
|
||||
knows. Play it safe though... */
|
||||
prefixArray = nil;
|
||||
}
|
||||
}
|
||||
else
|
||||
if (prefixes == nil)
|
||||
{
|
||||
NSString *strings[4];
|
||||
NSString *str;
|
||||
|
|
|
@ -57,7 +57,6 @@ AC_EXEEXT
|
|||
case "$target_os" in
|
||||
freebsd*) CPPFLAGS="$CPPFLAGS -I/usr/local/include"
|
||||
LIBS="$LIBS -L/usr/local/lib";;
|
||||
darwin1.3*) CPPFLAGS="$CPPFLAGS -force_cpusubtype_ALL";;
|
||||
|
||||
esac
|
||||
|
||||
|
|
Loading…
Reference in a new issue