mirror of
https://github.com/gnustep/libs-base.git
synced 2025-05-31 00:30:53 +00:00
Fix paths on Windows. Sparc gdb fix
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@11166 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
846935994d
commit
d8e42c9836
7 changed files with 115 additions and 31 deletions
18
ChangeLog
18
ChangeLog
|
@ -1,3 +1,21 @@
|
||||||
|
2001-10-16 Adam Fedor <fedor@gnu.org>
|
||||||
|
|
||||||
|
* Source/GNUmakefile: Strip drive names from paths.
|
||||||
|
|
||||||
|
* Source/GSXML.m: Add dummy GSXMLParser when not using libxml.
|
||||||
|
* Source/NSBundle.m (_absolutePathOfExecutable:): Check for
|
||||||
|
'Path' variable also (for Windows).
|
||||||
|
* Source/NSUser.m (GSStringFromWin32EnvironmentVariable): New
|
||||||
|
function.
|
||||||
|
(NSHomeDirectoryForUser): Use it.
|
||||||
|
(setupPathNames): Prepend systemDrive to compiled in root
|
||||||
|
paths.
|
||||||
|
(patches from stephen@brandonitconsulting.co.uk).
|
||||||
|
|
||||||
|
* Source/NSFileManager.m (_attributesAtPath:traverseLink:forCopy:):
|
||||||
|
On (sparc && DEBUG) disable the setgrent functions which cause gdb
|
||||||
|
to crash.
|
||||||
|
|
||||||
2001-10-15 Richard Frith-Macdonald <rfm@gnu.org>
|
2001-10-15 Richard Frith-Macdonald <rfm@gnu.org>
|
||||||
|
|
||||||
* Source/GNUmakefile:
|
* Source/GNUmakefile:
|
||||||
|
|
|
@ -42,6 +42,25 @@ LIBRARY_NAME=libgnustep-base
|
||||||
|
|
||||||
# GNUSTEP_INSTALL_PREFIX must be defined here and not in config.h because
|
# GNUSTEP_INSTALL_PREFIX must be defined here and not in config.h because
|
||||||
# the installing person may set it on the `make' command line.
|
# the installing person may set it on the `make' command line.
|
||||||
|
|
||||||
|
ifeq ($(GNUSTEP_TARGET_OS), mingw32)
|
||||||
|
|
||||||
|
GNUSTEP_TARGET_INSTALL_PREFIX := \
|
||||||
|
$(shell echo $(GNUSTEP_SYSTEM_ROOT) | sed 's|^[a-zA-Z]:/|/|')
|
||||||
|
GNUSTEP_TARGET_LOCAL_ROOT := \
|
||||||
|
$(shell echo $(GNUSTEP_LOCAL_ROOT) | sed 's|^[a-zA-Z]:/|/|')
|
||||||
|
GNUSTEP_TARGET_NETWORK_ROOT := \
|
||||||
|
$(shell echo $(GNUSTEP_NETWORK_ROOT) | sed 's|^[a-zA-Z]:/|/|')
|
||||||
|
DEFS= -DGNUSTEP_INSTALL_PREFIX=$(GNUSTEP_TARGET_INSTALL_PREFIX) \
|
||||||
|
-DGNUSTEP_LOCAL_ROOT=$(GNUSTEP_TARGET_LOCAL_ROOT) \
|
||||||
|
-DGNUSTEP_NETWORK_ROOT=$(GNUSTEP_TARGET_NETWORK_ROOT) \
|
||||||
|
-DGNUSTEP_TARGET_DIR=\"$(GNUSTEP_TARGET_DIR)\" \
|
||||||
|
-DGNUSTEP_TARGET_CPU=\"$(GNUSTEP_TARGET_CPU)\" \
|
||||||
|
-DGNUSTEP_TARGET_OS=\"$(GNUSTEP_TARGET_OS)\" \
|
||||||
|
-DLIBRARY_COMBO=\"$(LIBRARY_COMBO)\"
|
||||||
|
|
||||||
|
else
|
||||||
|
|
||||||
GNUSTEP_INSTALL_PREFIX=$(GNUSTEP_SYSTEM_ROOT)
|
GNUSTEP_INSTALL_PREFIX=$(GNUSTEP_SYSTEM_ROOT)
|
||||||
DEFS= -DGNUSTEP_INSTALL_PREFIX=$(GNUSTEP_INSTALL_PREFIX) \
|
DEFS= -DGNUSTEP_INSTALL_PREFIX=$(GNUSTEP_INSTALL_PREFIX) \
|
||||||
-DGNUSTEP_LOCAL_ROOT=$(GNUSTEP_LOCAL_ROOT) \
|
-DGNUSTEP_LOCAL_ROOT=$(GNUSTEP_LOCAL_ROOT) \
|
||||||
|
@ -51,6 +70,8 @@ DEFS= -DGNUSTEP_INSTALL_PREFIX=$(GNUSTEP_INSTALL_PREFIX) \
|
||||||
-DGNUSTEP_TARGET_OS=\"$(GNUSTEP_TARGET_OS)\" \
|
-DGNUSTEP_TARGET_OS=\"$(GNUSTEP_TARGET_OS)\" \
|
||||||
-DLIBRARY_COMBO=\"$(LIBRARY_COMBO)\"
|
-DLIBRARY_COMBO=\"$(LIBRARY_COMBO)\"
|
||||||
|
|
||||||
|
endif
|
||||||
|
|
||||||
# Grep for these names to build the legally-required "AUTHORS" file.
|
# Grep for these names to build the legally-required "AUTHORS" file.
|
||||||
FILE_AUTHORS = \
|
FILE_AUTHORS = \
|
||||||
"Andrew Kachites McCallum" \
|
"Andrew Kachites McCallum" \
|
||||||
|
|
|
@ -2159,7 +2159,8 @@ fatalErrorFunction(void *ctx, const char *msg, ...)
|
||||||
@end
|
@end
|
||||||
@interface GSSAXHandler : GSXMLDummy
|
@interface GSSAXHandler : GSXMLDummy
|
||||||
@end
|
@end
|
||||||
|
@interface GSXMLParser : GSXMLDummy
|
||||||
|
@end
|
||||||
@implementation GSXMLDummy
|
@implementation GSXMLDummy
|
||||||
+ (id) allocWithZone: (NSZone*)z
|
+ (id) allocWithZone: (NSZone*)z
|
||||||
{
|
{
|
||||||
|
@ -2194,6 +2195,7 @@ fatalErrorFunction(void *ctx, const char *msg, ...)
|
||||||
@end
|
@end
|
||||||
@implementation GSSAXHandler
|
@implementation GSSAXHandler
|
||||||
@end
|
@end
|
||||||
|
@implementation GSXMLParser
|
||||||
|
@end
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
|
@ -1329,6 +1329,12 @@ _bundle_load_callback(Class theClass, struct objc_category *theCategory)
|
||||||
mgr = [NSFileManager defaultManager];
|
mgr = [NSFileManager defaultManager];
|
||||||
env = [[NSProcessInfo processInfo] environment];
|
env = [[NSProcessInfo processInfo] environment];
|
||||||
pathlist = [env objectForKey:@"PATH"];
|
pathlist = [env objectForKey:@"PATH"];
|
||||||
|
|
||||||
|
/* Windows 2000 and perhaps others have "Path" not "PATH" */
|
||||||
|
if (pathlist == nil)
|
||||||
|
{
|
||||||
|
pathlist = [env objectForKey:@"Path"];
|
||||||
|
}
|
||||||
#if defined(__MINGW__)
|
#if defined(__MINGW__)
|
||||||
patharr = [pathlist componentsSeparatedByString:@";"];
|
patharr = [pathlist componentsSeparatedByString:@";"];
|
||||||
#else
|
#else
|
||||||
|
|
|
@ -1948,6 +1948,10 @@ static SEL swfsSel = 0;
|
||||||
return YES;
|
return YES;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if (defined(sparc) && defined(DEBUG))
|
||||||
|
static int sparc_warn = 0;
|
||||||
|
#endif
|
||||||
|
|
||||||
- (NSDictionary*) _attributesAtPath: (NSString*)path
|
- (NSDictionary*) _attributesAtPath: (NSString*)path
|
||||||
traverseLink: (BOOL)traverse
|
traverseLink: (BOOL)traverse
|
||||||
forCopy: (BOOL)copy
|
forCopy: (BOOL)copy
|
||||||
|
@ -2048,7 +2052,7 @@ static SEL swfsSel = 0;
|
||||||
values[8] = @"UnknownUser";
|
values[8] = @"UnknownUser";
|
||||||
#endif /* HAVE_PWD_H */
|
#endif /* HAVE_PWD_H */
|
||||||
|
|
||||||
#if HAVE_GRP_H
|
#if defined(HAVE_GRP_H) && !(defined(sparc) && defined(DEBUG))
|
||||||
{
|
{
|
||||||
struct group *gp;
|
struct group *gp;
|
||||||
|
|
||||||
|
@ -2071,6 +2075,13 @@ static SEL swfsSel = 0;
|
||||||
endgrent();
|
endgrent();
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
|
#if (defined(sparc) && defined(DEBUG))
|
||||||
|
if (sparc_warn == 0)
|
||||||
|
{
|
||||||
|
sparc_warn = 1;
|
||||||
|
NSLog(@"WARNING (NSFileManager): Disabling group enums (setgrent, etc) since this crashes gdb on sparc machines");
|
||||||
|
}
|
||||||
|
#endif
|
||||||
values[9] = @"UnknownGroup";
|
values[9] = @"UnknownGroup";
|
||||||
#endif
|
#endif
|
||||||
values[10] = [NSNumber numberWithUnsignedInt: statbuf.st_uid];
|
values[10] = [NSNumber numberWithUnsignedInt: statbuf.st_uid];
|
||||||
|
|
|
@ -46,7 +46,8 @@
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
|
||||||
#define stringify(X) #X
|
#define lowlevelstringify(X) #X
|
||||||
|
#define stringify(X) lowlevelstringify(X)
|
||||||
|
|
||||||
static NSString *theUserName = nil;
|
static NSString *theUserName = nil;
|
||||||
|
|
||||||
|
@ -124,7 +125,7 @@ NSUserName(void)
|
||||||
GSSetUserName([NSString stringWithCString: login_name]);
|
GSSetUserName([NSString stringWithCString: login_name]);
|
||||||
else
|
else
|
||||||
[NSException raise: NSInternalInconsistencyException
|
[NSException raise: NSInternalInconsistencyException
|
||||||
format: @"Unable to determine curren user name"];
|
format: @"Unable to determine current user name"];
|
||||||
}
|
}
|
||||||
return theUserName;
|
return theUserName;
|
||||||
}
|
}
|
||||||
|
@ -136,6 +137,36 @@ NSHomeDirectory(void)
|
||||||
return NSHomeDirectoryForUser (NSUserName ());
|
return NSHomeDirectoryForUser (NSUserName ());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if defined(__MINGW__)
|
||||||
|
NSString *
|
||||||
|
GSStringFromWin32EnvironmentVariable(const char * envVar)
|
||||||
|
{
|
||||||
|
char buf[1024], *nb;
|
||||||
|
DWORD n;
|
||||||
|
NSString *s = nil;
|
||||||
|
|
||||||
|
[gnustep_global_lock lock];
|
||||||
|
n = GetEnvironmentVariable(envVar, buf, 1024);
|
||||||
|
if (n > 1024)
|
||||||
|
{
|
||||||
|
/* Buffer not big enough, so dynamically allocate it */
|
||||||
|
nb = (char *)NSZoneMalloc(NSDefaultMallocZone(), sizeof(char)*(n+1));
|
||||||
|
n = GetEnvironmentVariable(envVar, nb, n+1);
|
||||||
|
nb[n] = '\0';
|
||||||
|
s = [NSString stringWithCString: nb];
|
||||||
|
NSZoneFree(NSDefaultMallocZone(), nb);
|
||||||
|
}
|
||||||
|
else if (n > 0)
|
||||||
|
{
|
||||||
|
/* null terminate it and return the string */
|
||||||
|
buf[n] = '\0';
|
||||||
|
s = [NSString stringWithCString: buf];
|
||||||
|
}
|
||||||
|
[gnustep_global_lock unlock];
|
||||||
|
return s;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
/* Return LOGIN_NAME's home directory as an NSString object. */
|
/* Return LOGIN_NAME's home directory as an NSString object. */
|
||||||
NSString *
|
NSString *
|
||||||
NSHomeDirectoryForUser(NSString *login_name)
|
NSHomeDirectoryForUser(NSString *login_name)
|
||||||
|
@ -150,37 +181,14 @@ NSHomeDirectoryForUser(NSString *login_name)
|
||||||
#else
|
#else
|
||||||
/* Then environment variable HOMEPATH holds the home directory
|
/* Then environment variable HOMEPATH holds the home directory
|
||||||
for the user on Windows NT; Win95 has no concept of home. */
|
for the user on Windows NT; Win95 has no concept of home. */
|
||||||
char buf[1024], *nb;
|
|
||||||
DWORD n;
|
|
||||||
NSString *s;
|
NSString *s;
|
||||||
|
|
||||||
[gnustep_global_lock lock];
|
[gnustep_global_lock lock];
|
||||||
n = GetEnvironmentVariable("HOMEPATH", buf, 1024);
|
s = GSStringFromWin32EnvironmentVariable("HOMEPATH");
|
||||||
if (n > 1024)
|
|
||||||
{
|
|
||||||
/* Buffer not big enough, so dynamically allocate it */
|
|
||||||
nb = (char *)NSZoneMalloc(NSDefaultMallocZone(), sizeof(char)*(n+1));
|
|
||||||
n = GetEnvironmentVariable("HOMEPATH", nb, n+1);
|
|
||||||
nb[n] = '\0';
|
|
||||||
s = [NSString stringWithCString: nb];
|
|
||||||
NSZoneFree(NSDefaultMallocZone(), nb);
|
|
||||||
}
|
|
||||||
else if (n > 0)
|
|
||||||
{
|
|
||||||
/* null terminate it and return the string */
|
|
||||||
buf[n] = '\0';
|
|
||||||
s = [NSString stringWithCString: buf];
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
s = nil;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (s != nil)
|
if (s != nil)
|
||||||
{
|
{
|
||||||
n = GetEnvironmentVariable("HOMEDRIVE", buf, 1024);
|
s = [GSStringFromWin32EnvironmentVariable("HOMEDRIVE")
|
||||||
buf[n] = '\0';
|
stringByAppendingString: s];
|
||||||
s = [[NSString stringWithCString: buf] stringByAppendingString: s];
|
|
||||||
}
|
}
|
||||||
[gnustep_global_lock unlock];
|
[gnustep_global_lock unlock];
|
||||||
return s;
|
return s;
|
||||||
|
@ -211,6 +219,9 @@ static NSString *gnustep_system_root = nil; /* GNUSTEP_SYSTEM_ROOT */
|
||||||
static void
|
static void
|
||||||
setupPathNames()
|
setupPathNames()
|
||||||
{
|
{
|
||||||
|
#if defined (__MINGW32__)
|
||||||
|
NSString *systemDrive = GSStringFromWin32EnvironmentVariable("SystemDrive");
|
||||||
|
#endif
|
||||||
if (gnustep_system_root == nil)
|
if (gnustep_system_root == nil)
|
||||||
{
|
{
|
||||||
NS_DURING
|
NS_DURING
|
||||||
|
@ -238,6 +249,11 @@ setupPathNames()
|
||||||
warned = YES;
|
warned = YES;
|
||||||
gnustep_system_root = [NSString stringWithCString:
|
gnustep_system_root = [NSString stringWithCString:
|
||||||
stringify(GNUSTEP_INSTALL_PREFIX)];
|
stringify(GNUSTEP_INSTALL_PREFIX)];
|
||||||
|
#if defined (__MINGW32__)
|
||||||
|
gnustep_system_root = [systemDrive stringByAppendingString:
|
||||||
|
gnustep_system_root];
|
||||||
|
#endif
|
||||||
|
|
||||||
RETAIN(gnustep_system_root);
|
RETAIN(gnustep_system_root);
|
||||||
fprintf (stderr,
|
fprintf (stderr,
|
||||||
"Warning - GNUSTEP_SYSTEM_ROOT is not set "
|
"Warning - GNUSTEP_SYSTEM_ROOT is not set "
|
||||||
|
@ -250,6 +266,10 @@ setupPathNames()
|
||||||
{
|
{
|
||||||
gnustep_local_root = [NSString stringWithCString:
|
gnustep_local_root = [NSString stringWithCString:
|
||||||
stringify(GNUSTEP_LOCAL_ROOT)];
|
stringify(GNUSTEP_LOCAL_ROOT)];
|
||||||
|
#if defined (__MINGW32__)
|
||||||
|
gnustep_local_root = [systemDrive stringByAppendingString:
|
||||||
|
gnustep_local_root];
|
||||||
|
#endif
|
||||||
if ([gnustep_local_root length] == 0)
|
if ([gnustep_local_root length] == 0)
|
||||||
gnustep_local_root = nil;
|
gnustep_local_root = nil;
|
||||||
else
|
else
|
||||||
|
@ -287,6 +307,10 @@ setupPathNames()
|
||||||
{
|
{
|
||||||
gnustep_network_root = [NSString stringWithCString:
|
gnustep_network_root = [NSString stringWithCString:
|
||||||
stringify(GNUSTEP_NETWORK_ROOT)];
|
stringify(GNUSTEP_NETWORK_ROOT)];
|
||||||
|
#if defined (__MINGW32__)
|
||||||
|
gnustep_network_root = [systemDrive stringByAppendingString:
|
||||||
|
gnustep_network_root];
|
||||||
|
#endif
|
||||||
if ([gnustep_network_root length] == 0)
|
if ([gnustep_network_root length] == 0)
|
||||||
gnustep_network_root = nil;
|
gnustep_network_root = nil;
|
||||||
else
|
else
|
||||||
|
|
|
@ -208,4 +208,6 @@ __objc_class_name_NSUndoManager
|
||||||
__objc_class_name_PrivateUndoGroup
|
__objc_class_name_PrivateUndoGroup
|
||||||
__objc_class_name_NSUserDefaults
|
__objc_class_name_NSUserDefaults
|
||||||
__objc_class_name_GSPlaceholderValue
|
__objc_class_name_GSPlaceholderValue
|
||||||
|
__objc_class_name_GSXMLNode
|
||||||
|
__objc_class_name_GSXMLParser
|
||||||
__objc_class_name_NSValue
|
__objc_class_name_NSValue
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue