mirror of
https://github.com/gnustep/libs-base.git
synced 2025-04-22 16:33:29 +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
3d357aba9f
commit
1e287c7727
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>
|
||||
|
||||
* Source/GNUmakefile:
|
||||
|
|
|
@ -42,6 +42,25 @@ LIBRARY_NAME=libgnustep-base
|
|||
|
||||
# GNUSTEP_INSTALL_PREFIX must be defined here and not in config.h because
|
||||
# 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)
|
||||
DEFS= -DGNUSTEP_INSTALL_PREFIX=$(GNUSTEP_INSTALL_PREFIX) \
|
||||
-DGNUSTEP_LOCAL_ROOT=$(GNUSTEP_LOCAL_ROOT) \
|
||||
|
@ -51,6 +70,8 @@ DEFS= -DGNUSTEP_INSTALL_PREFIX=$(GNUSTEP_INSTALL_PREFIX) \
|
|||
-DGNUSTEP_TARGET_OS=\"$(GNUSTEP_TARGET_OS)\" \
|
||||
-DLIBRARY_COMBO=\"$(LIBRARY_COMBO)\"
|
||||
|
||||
endif
|
||||
|
||||
# Grep for these names to build the legally-required "AUTHORS" file.
|
||||
FILE_AUTHORS = \
|
||||
"Andrew Kachites McCallum" \
|
||||
|
|
|
@ -2159,7 +2159,8 @@ fatalErrorFunction(void *ctx, const char *msg, ...)
|
|||
@end
|
||||
@interface GSSAXHandler : GSXMLDummy
|
||||
@end
|
||||
|
||||
@interface GSXMLParser : GSXMLDummy
|
||||
@end
|
||||
@implementation GSXMLDummy
|
||||
+ (id) allocWithZone: (NSZone*)z
|
||||
{
|
||||
|
@ -2194,6 +2195,7 @@ fatalErrorFunction(void *ctx, const char *msg, ...)
|
|||
@end
|
||||
@implementation GSSAXHandler
|
||||
@end
|
||||
|
||||
@implementation GSXMLParser
|
||||
@end
|
||||
#endif
|
||||
|
||||
|
|
|
@ -1329,6 +1329,12 @@ _bundle_load_callback(Class theClass, struct objc_category *theCategory)
|
|||
mgr = [NSFileManager defaultManager];
|
||||
env = [[NSProcessInfo processInfo] environment];
|
||||
pathlist = [env objectForKey:@"PATH"];
|
||||
|
||||
/* Windows 2000 and perhaps others have "Path" not "PATH" */
|
||||
if (pathlist == nil)
|
||||
{
|
||||
pathlist = [env objectForKey:@"Path"];
|
||||
}
|
||||
#if defined(__MINGW__)
|
||||
patharr = [pathlist componentsSeparatedByString:@";"];
|
||||
#else
|
||||
|
|
|
@ -1948,6 +1948,10 @@ static SEL swfsSel = 0;
|
|||
return YES;
|
||||
}
|
||||
|
||||
#if (defined(sparc) && defined(DEBUG))
|
||||
static int sparc_warn = 0;
|
||||
#endif
|
||||
|
||||
- (NSDictionary*) _attributesAtPath: (NSString*)path
|
||||
traverseLink: (BOOL)traverse
|
||||
forCopy: (BOOL)copy
|
||||
|
@ -2048,7 +2052,7 @@ static SEL swfsSel = 0;
|
|||
values[8] = @"UnknownUser";
|
||||
#endif /* HAVE_PWD_H */
|
||||
|
||||
#if HAVE_GRP_H
|
||||
#if defined(HAVE_GRP_H) && !(defined(sparc) && defined(DEBUG))
|
||||
{
|
||||
struct group *gp;
|
||||
|
||||
|
@ -2071,6 +2075,13 @@ static SEL swfsSel = 0;
|
|||
endgrent();
|
||||
}
|
||||
#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";
|
||||
#endif
|
||||
values[10] = [NSNumber numberWithUnsignedInt: statbuf.st_uid];
|
||||
|
|
|
@ -46,7 +46,8 @@
|
|||
#include <sys/types.h>
|
||||
#include <stdio.h>
|
||||
|
||||
#define stringify(X) #X
|
||||
#define lowlevelstringify(X) #X
|
||||
#define stringify(X) lowlevelstringify(X)
|
||||
|
||||
static NSString *theUserName = nil;
|
||||
|
||||
|
@ -124,7 +125,7 @@ NSUserName(void)
|
|||
GSSetUserName([NSString stringWithCString: login_name]);
|
||||
else
|
||||
[NSException raise: NSInternalInconsistencyException
|
||||
format: @"Unable to determine curren user name"];
|
||||
format: @"Unable to determine current user name"];
|
||||
}
|
||||
return theUserName;
|
||||
}
|
||||
|
@ -136,6 +137,36 @@ NSHomeDirectory(void)
|
|||
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. */
|
||||
NSString *
|
||||
NSHomeDirectoryForUser(NSString *login_name)
|
||||
|
@ -150,37 +181,14 @@ NSHomeDirectoryForUser(NSString *login_name)
|
|||
#else
|
||||
/* Then environment variable HOMEPATH holds the home directory
|
||||
for the user on Windows NT; Win95 has no concept of home. */
|
||||
char buf[1024], *nb;
|
||||
DWORD n;
|
||||
NSString *s;
|
||||
|
||||
[gnustep_global_lock lock];
|
||||
n = GetEnvironmentVariable("HOMEPATH", buf, 1024);
|
||||
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;
|
||||
}
|
||||
|
||||
s = GSStringFromWin32EnvironmentVariable("HOMEPATH");
|
||||
if (s != nil)
|
||||
{
|
||||
n = GetEnvironmentVariable("HOMEDRIVE", buf, 1024);
|
||||
buf[n] = '\0';
|
||||
s = [[NSString stringWithCString: buf] stringByAppendingString: s];
|
||||
s = [GSStringFromWin32EnvironmentVariable("HOMEDRIVE")
|
||||
stringByAppendingString: s];
|
||||
}
|
||||
[gnustep_global_lock unlock];
|
||||
return s;
|
||||
|
@ -211,6 +219,9 @@ static NSString *gnustep_system_root = nil; /* GNUSTEP_SYSTEM_ROOT */
|
|||
static void
|
||||
setupPathNames()
|
||||
{
|
||||
#if defined (__MINGW32__)
|
||||
NSString *systemDrive = GSStringFromWin32EnvironmentVariable("SystemDrive");
|
||||
#endif
|
||||
if (gnustep_system_root == nil)
|
||||
{
|
||||
NS_DURING
|
||||
|
@ -238,6 +249,11 @@ setupPathNames()
|
|||
warned = YES;
|
||||
gnustep_system_root = [NSString stringWithCString:
|
||||
stringify(GNUSTEP_INSTALL_PREFIX)];
|
||||
#if defined (__MINGW32__)
|
||||
gnustep_system_root = [systemDrive stringByAppendingString:
|
||||
gnustep_system_root];
|
||||
#endif
|
||||
|
||||
RETAIN(gnustep_system_root);
|
||||
fprintf (stderr,
|
||||
"Warning - GNUSTEP_SYSTEM_ROOT is not set "
|
||||
|
@ -250,6 +266,10 @@ setupPathNames()
|
|||
{
|
||||
gnustep_local_root = [NSString stringWithCString:
|
||||
stringify(GNUSTEP_LOCAL_ROOT)];
|
||||
#if defined (__MINGW32__)
|
||||
gnustep_local_root = [systemDrive stringByAppendingString:
|
||||
gnustep_local_root];
|
||||
#endif
|
||||
if ([gnustep_local_root length] == 0)
|
||||
gnustep_local_root = nil;
|
||||
else
|
||||
|
@ -287,6 +307,10 @@ setupPathNames()
|
|||
{
|
||||
gnustep_network_root = [NSString stringWithCString:
|
||||
stringify(GNUSTEP_NETWORK_ROOT)];
|
||||
#if defined (__MINGW32__)
|
||||
gnustep_network_root = [systemDrive stringByAppendingString:
|
||||
gnustep_network_root];
|
||||
#endif
|
||||
if ([gnustep_network_root length] == 0)
|
||||
gnustep_network_root = nil;
|
||||
else
|
||||
|
|
|
@ -208,4 +208,6 @@ __objc_class_name_NSUndoManager
|
|||
__objc_class_name_PrivateUndoGroup
|
||||
__objc_class_name_NSUserDefaults
|
||||
__objc_class_name_GSPlaceholderValue
|
||||
__objc_class_name_GSXMLNode
|
||||
__objc_class_name_GSXMLParser
|
||||
__objc_class_name_NSValue
|
||||
|
|
Loading…
Reference in a new issue