cvs diff -u (in directory C:\Users\jeremy\gnustep-cvs\base\)
Index: Headers/Foundation/NSFileManager.h
===================================================================
RCS file: /cvsroot/gnustep/gnustep/core/base/Headers/Foundation/NSFileManager.h,v
retrieving revision 1.8
diff -u -r1.8 NSFileManager.h
--- Headers/Foundation/NSFileManager.h 23 Oct 2005 14:53:03 -0000 1.8
+++ Headers/Foundation/NSFileManager.h 28 Oct 2005 19:26:21 -0000
@@ -221,12 +221,14 @@
* Convert from OpenStep internal string format to a string in
* the local filesystem format, suitable for passing to system functions.
* This representation may vary between filesystems.
- * On windows, the filesystem representation is 16-bit unicode and is expected
- * to be used in conjunction with the variants of system calls which work
- * with unicode strings.
* Raises an exception if the character conversion is not possible.
*/
+- (const unichar*) unicodeFileSystemRepresentationWithPath: (NSString*)path;
- (const char*) fileSystemRepresentationWithPath: (NSString*)path;
+#ifndef NO_GNUSTEP
+- (NSString*) localFromOpenStepPath:(NSString*)path;
+- (NSString*) openStepPathFromLocal:(NSString*)localPath;
+#endif
- (BOOL) isExecutableFileAtPath: (NSString*)path;
- (BOOL) isDeletableFileAtPath: (NSString*)path;
Index: Headers/Foundation/NSString.h
===================================================================
RCS file: /cvsroot/gnustep/gnustep/core/base/Headers/Foundation/NSString.h,v
retrieving revision 1.24
diff -u -r1.24 NSString.h
--- Headers/Foundation/NSString.h 23 Oct 2005 14:53:03 -0000 1.24
+++ Headers/Foundation/NSString.h 31 Oct 2005 21:16:50 -0000
@@ -342,18 +342,18 @@
* unicode character string, so you should only path the value returned by
* this method to functions expecting wide characters.
*/
+- (const unichar*) unicodeFileSystemRepresentation;
- (const char*) fileSystemRepresentation;
/**
* Converts the receiver to a C string path using the character encoding
* appropriate to the local file system. This string will be stored
* into buffer if it is shorter than size, otherwise NO is returned.
- * NB. On ms-windows the filesystem representation of a path is a 16-bit
- * unicode character string, so the buffer you pass to this method must be
- * twice as long as the number of characters you expect to receive.
*/
+- (BOOL) getUnicodeFileSystemRepresentation: (unichar*)buffer
+ maxLength: (unsigned int)length;
- (BOOL) getFileSystemRepresentation: (char*)buffer
- maxLength: (unsigned int)size;
+ maxLength: (unsigned int)length;
/**
* Returns a string containing the last path component of the receiver.
Index: Source/GSFileHandle.m
===================================================================
RCS file: /cvsroot/gnustep/gnustep/core/base/Source/GSFileHandle.m,v
retrieving revision 1.33
diff -u -r1.33 GSFileHandle.m
--- Source/GSFileHandle.m 31 Oct 2005 20:50:25 -0000 1.33
+++ Source/GSFileHandle.m 4 Nov 2005 20:38:25 -0000
@@ -1009,9 +1009,7 @@
- (id) initForReadingAtPath: (NSString*)path
{
#if defined(__MINGW32__)
- int d = _wopen(
- (unichar*)[path cStringUsingEncoding: NSUnicodeStringEncoding],
- O_RDONLY|O_BINARY);
+ int d = _wopen([path unicodeFileSystemRepresentation], O_RDONLY|O_BINARY);
#else
int d = open([path fileSystemRepresentation], O_RDONLY|O_BINARY);
#endif
@@ -1037,9 +1035,7 @@
- (id) initForWritingAtPath: (NSString*)path
{
#if defined(__MINGW32__)
- int d = _wopen(
- (unichar*)[path cStringUsingEncoding: NSUnicodeStringEncoding],
- O_WRONLY|O_BINARY);
+ int d = _wopen([path unicodeFileSystemRepresentation], O_WRONLY|O_BINARY);
#else
int d = open([path fileSystemRepresentation], O_WRONLY|O_BINARY);
#endif
@@ -1065,9 +1061,7 @@
- (id) initForUpdatingAtPath: (NSString*)path
{
#if defined(__MINGW32__)
- int d = _wopen(
- (unichar*)[path cStringUsingEncoding: NSUnicodeStringEncoding],
- O_RDWR|O_BINARY);
+ int d = _wopen([path unicodeFileSystemRepresentation], O_RDWR|O_BINARY);
#else
int d = open([path fileSystemRepresentation], O_RDWR|O_BINARY);
#endif
Index: Source/GSHTTPURLHandle.m
===================================================================
RCS file: /cvsroot/gnustep/gnustep/core/base/Source/GSHTTPURLHandle.m,v
retrieving revision 1.68
diff -u -r1.68 GSHTTPURLHandle.m
--- Source/GSHTTPURLHandle.m 31 Oct 2005 14:01:17 -0000 1.68
+++ Source/GSHTTPURLHandle.m 4 Nov 2005 20:38:26 -0000
@@ -221,8 +221,13 @@
int d;
[debugLock lock];
- d = open([debugFile fileSystemRepresentation],
+#ifdef __MINGW32__
+ d = _wopen([debugFile unicodeFileSystemRepresentation],
+ O_WRONLY|O_CREAT|O_APPEND, 0644);
+#else
+ d = open([debugFile fileSystemRepresentation],
O_WRONLY|O_CREAT|O_APPEND, 0644);
+#endif
if (d >= 0)
{
s = [NSString stringWithFormat: @"\nRead for %x at %@ %u bytes - '",
@@ -240,8 +245,13 @@
int d;
[debugLock lock];
+#ifdef __MINGW32__
+ d = _wopen([debugFile unicodeFileSystemRepresentation],
+ O_WRONLY|O_CREAT|O_APPEND, 0644);
+#else
d = open([debugFile fileSystemRepresentation],
O_WRONLY|O_CREAT|O_APPEND, 0644);
+#endif
if (d >= 0)
{
s = [NSString stringWithFormat: @"\nWrite for %x at %@ %u bytes - '",
Index: Source/NSBundle.m
===================================================================
RCS file: /cvsroot/gnustep/gnustep/core/base/Source/NSBundle.m,v
retrieving revision 1.147
diff -u -r1.147 NSBundle.m
--- Source/NSBundle.m 21 Oct 2005 02:20:41 -0000 1.147
+++ Source/NSBundle.m 2 Nov 2005 16:52:26 -0000
@@ -119,12 +119,21 @@
/* This function is provided for objc-load.c, although I'm not sure it
really needs it (So far only needed if using GNU dld library) */
+#ifdef __MINGW32__
+const unichar *
+objc_executable_location (void)
+{
+ return [[_executable_path stringByDeletingLastPathComponent]
+ unicodeFileSystemRepresentation];
+}
+#else
const char *
objc_executable_location (void)
{
return [[_executable_path stringByDeletingLastPathComponent]
fileSystemRepresentation];
}
+#endif
static BOOL
bundle_directory_readable(NSString *path)
@@ -1122,8 +1131,13 @@
_codeLoaded before loading the bundle. */
_codeLoaded = YES;
+#ifdef __MINGW32__
+ if (objc_load_module([object unicodeFileSystemRepresentation],
+ stderr, _bundle_load_callback, NULL, NULL))
+#else
if (objc_load_module([object fileSystemRepresentation],
stderr, _bundle_load_callback, NULL, NULL))
+#endif
{
_codeLoaded = NO;
DESTROY(_loadingFrameworks);
Index: Source/NSData.m
===================================================================
RCS file: /cvsroot/gnustep/gnustep/core/base/Source/NSData.m,v
retrieving revision 1.156
diff -u -r1.156 NSData.m
--- Source/NSData.m 11 Oct 2005 19:09:25 -0000 1.156
+++ Source/NSData.m 28 Oct 2005 19:30:04 -0000
@@ -147,7 +147,7 @@
#endif
#if defined(__MINGW32__)
- thePath = (const unichar*)[path fileSystemRepresentation];
+ thePath = [path unicodeFileSystemRepresentation];
#else
thePath = [path fileSystemRepresentation];
#endif
@@ -2887,7 +2887,7 @@
int fd;
#if defined(__MINGW32__)
- const unichar *thePath = (const unichar*)[path filesystemRepresentation];
+ const unichar *thePath = [path unicodeFileSystemRepresentation];
#else
const char *thePath = [path fileSystemRepresentation];
#endif
Index: Source/NSFileManager.m
===================================================================
RCS file: /cvsroot/gnustep/gnustep/core/base/Source/NSFileManager.m,v
retrieving revision 1.120
diff -u -r1.120 NSFileManager.m
--- Source/NSFileManager.m 23 Oct 2005 14:53:03 -0000 1.120
+++ Source/NSFileManager.m 2 Nov 2005 21:56:39 -0000
@@ -201,6 +201,8 @@
#define _UTIMB _utimbuf
#define _NUL L'\0'
+#define _FILESYSTEMREPRESENTATIONWITHPATH unicodeFileSystemRepresentationWithPath
+
#else
@@ -220,6 +222,7 @@
#define _UTIMB utimbuf
#define _NUL '\0'
+#define _FILESYSTEMREPRESENTATIONWITHPATH fileSystemRepresentationWithPath
#endif
@@ -355,10 +358,11 @@
*/
- (BOOL) changeCurrentDirectoryPath: (NSString*)path
{
- const _CHAR *lpath = (_CCP)[self fileSystemRepresentationWithPath: path];
#if defined(__MINGW32__)
- return SetCurrentDirectory(lpath) == TRUE ? YES : NO;
+ const _CHAR *lpath = [self unicodeFileSystemRepresentationWithPath: path];
+ return SetCurrentDirectoryW(lpath) == TRUE ? YES : NO;
#else
+ const _CHAR *lpath = [self fileSystemRepresentationWithPath: path];
return (chdir(lpath) == 0) ? YES : NO;
#endif
}
@@ -381,9 +385,8 @@
{
return YES;
}
- lpath = (_CCP)[defaultManager fileSystemRepresentationWithPath: path];
-
#ifndef __MINGW32__
+ lpath = [defaultManager fileSystemRepresentationWithPath: path];
num = [attributes fileOwnerAccountID];
if (num != NSNotFound)
{
@@ -456,6 +459,8 @@
ASSIGN(_lastError, str);
}
}
+#else
+ lpath = [defaultManager unicodeFileSystemRepresentationWithPath: path];
#endif /* __MINGW32__ */
num = [attributes filePosixPermissions];
@@ -665,8 +670,8 @@
{
const _CHAR *lpath;
- lpath = (_CCP)[self fileSystemRepresentationWithPath: completePath];
- if (CreateDirectory(lpath, 0) == FALSE)
+ lpath = [self unicodeFileSystemRepresentationWithPath: completePath];
+ if (CreateDirectoryW(lpath, 0) == FALSE)
{
return NO;
}
@@ -787,7 +792,7 @@
attributes: (NSDictionary*)attributes
{
#if defined(__MINGW32__)
- const _CHAR *lpath = (_CCP)[self fileSystemRepresentationWithPath: path];
+ const _CHAR *lpath = [self unicodeFileSystemRepresentationWithPath: path];
HANDLE fh;
DWORD written = 0;
DWORD len = [contents length];
@@ -803,7 +808,7 @@
return NO;
#if defined(__MINGW32__)
- fh = CreateFile(lpath, GENERIC_WRITE, 0, 0, CREATE_ALWAYS,
+ fh = CreateFileW(lpath, GENERIC_WRITE, 0, 0, CREATE_ALWAYS,
FILE_ATTRIBUTE_NORMAL, 0);
if (fh == INVALID_HANDLE_VALUE)
{
@@ -1024,8 +1029,8 @@
const _CHAR *sourcePath;
const _CHAR *destPath;
- sourcePath = (_CCP)[self fileSystemRepresentationWithPath: source];
- destPath = (_CCP)[self fileSystemRepresentationWithPath: destination];
+ sourcePath = [self _FILESYSTEMREPRESENTATIONWITHPATH: source];
+ destPath = [self _FILESYSTEMREPRESENTATIONWITHPATH: destination];
if ([self fileExistsAtPath: destination] == YES)
{
@@ -1216,7 +1221,7 @@
[self _sendToHandler: handler willProcessPath: path];
- lpath = (_CCP)[self fileSystemRepresentationWithPath: path];
+ lpath = [self _FILESYSTEMREPRESENTATIONWITHPATH: path];
if (lpath == 0 || *lpath == 0)
{
return NO;
@@ -1254,7 +1259,7 @@
if (!is_dir)
{
#if defined(__MINGW32__)
- if (DeleteFile(lpath) == FALSE)
+ if (DeleteFileW(lpath) == FALSE)
#else
if (unlink(lpath) < 0)
#endif
@@ -1291,7 +1296,7 @@
}
}
- if (_RMDIR((_CCP)[self fileSystemRepresentationWithPath: path]) < 0)
+ if (_RMDIR([self _FILESYSTEMREPRESENTATIONWITHPATH: path]) < 0)
{
return [self _proceedAccordingToHandler: handler
forError: [NSString stringWithCString: GSLastErrorStr (errno)]
@@ -1320,7 +1325,7 @@
*/
- (BOOL) fileExistsAtPath: (NSString*)path isDirectory: (BOOL*)isDirectory
{
- const _CHAR *lpath = (_CCP)[self fileSystemRepresentationWithPath: path];
+ const _CHAR *lpath = [self _FILESYSTEMREPRESENTATIONWITHPATH: path];
if (isDirectory != 0)
{
@@ -1379,7 +1384,7 @@
*/
- (BOOL) isReadableFileAtPath: (NSString*)path
{
- const _CHAR* lpath = (_CCP)[self fileSystemRepresentationWithPath: path];
+ const _CHAR* lpath = [self _FILESYSTEMREPRESENTATIONWITHPATH: path];
if (lpath == 0 || *lpath == _NUL)
{
@@ -1415,7 +1420,7 @@
*/
- (BOOL) isWritableFileAtPath: (NSString*)path
{
- const _CHAR* lpath = (_CCP)[self fileSystemRepresentationWithPath: path];
+ const _CHAR* lpath = [self _FILESYSTEMREPRESENTATIONWITHPATH: path];
if (lpath == 0 || *lpath == _NUL)
{
@@ -1456,7 +1461,7 @@
*/
- (BOOL) isExecutableFileAtPath: (NSString*)path
{
- const _CHAR* lpath = (_CCP)[self fileSystemRepresentationWithPath: path];
+ const _CHAR* lpath = [self _FILESYSTEMREPRESENTATIONWITHPATH: path];
if (lpath == 0 || *lpath == _NUL)
{
@@ -1473,6 +1478,7 @@
{
return NO;
}
+ // TODO: Actually should check all extensions in env var PATHEXT
if ([[[path pathExtension] lowercaseString] isEqualToString: @"exe"])
{
return YES;
@@ -1502,7 +1508,7 @@
*/
- (BOOL) isDeletableFileAtPath: (NSString*)path
{
- const _CHAR* lpath = (_CCP)[self fileSystemRepresentationWithPath: path];
+ const _CHAR* lpath = [self _FILESYSTEMREPRESENTATIONWITHPATH: path];
if (lpath == 0 || *lpath == _NUL)
{
@@ -1619,7 +1625,7 @@
NSDictionary *d;
d = [GSAttrDictionary attributesAt:
- (_CCP)[self fileSystemRepresentationWithPath: path] traverseLink: flag];
+ [self _FILESYSTEMREPRESENTATIONWITHPATH: path] traverseLink: flag];
return d;
}
@@ -1653,7 +1659,7 @@
};
DWORD SectorsPerCluster, BytesPerSector, NumberFreeClusters;
DWORD TotalNumberClusters;
- const _CHAR *lpath = (_CCP)[self fileSystemRepresentationWithPath: path];
+ const _CHAR *lpath = [self _FILESYSTEMREPRESENTATIONWITHPATH: path];
if (!GetDiskFreeSpace(lpath, &SectorsPerCluster,
&BytesPerSector, &NumberFreeClusters, &TotalNumberClusters))
@@ -1884,38 +1890,46 @@
#endif
}
+- (const unichar*) unicodeFileSystemRepresentationWithPath: (NSString*)path
+{
+ const unichar *c_path = 0;
+
+ if (path != nil)
+ {
+ c_path = (const unichar*)[path cStringUsingEncoding: NSUnicodeStringEncoding];
+ }
+
+ return c_path;
+}
+
- (const char*) fileSystemRepresentationWithPath: (NSString*)path
{
- const _CHAR *c_path = 0;
+ const char *c_path = 0;
if (path != nil)
{
-#ifdef __MINGW32__
- c_path = (_CCP)[path cStringUsingEncoding: NSUnicodeStringEncoding];
-#else
- c_path = (_CCP)[path cStringUsingEncoding: defaultEncoding];
-#endif
+ c_path = [path cStringUsingEncoding: defaultEncoding];
}
- return (const char*)c_path;
+ return c_path;
}
/**
* This method converts from a local filesystem specific name
* to an NSString object. Use it to convert a filename returned by
* a systemcall into a value for internal use.
- * The value of len is the number of bytes of data pointed to by string.
- * On windows, the filesystem representation is utf-16.
*/
+- (NSString*) stringWithUnicodeFileSystemRepresentation: (const unichar*)string
+ length: (unsigned int)len
+{
+ return [NSString stringWithCharacters: (const unichar*)string length: len];
+}
+
- (NSString*) stringWithFileSystemRepresentation: (const char*)string
length: (unsigned int)len
{
-#ifdef __MINGW32__
- return [NSString stringWithCharacters: (const unichar*)string length: len/2];
-#else
return AUTORELEASE([[NSString allocWithZone: NSDefaultMallocZone()]
initWithBytes: string length: len encoding: defaultEncoding]);
-#endif
}
@end /* NSFileManager */
@@ -2008,7 +2022,7 @@
_topPath = [[NSString alloc] initWithString: path];
- localPath = (_CCP)[_mgr fileSystemRepresentationWithPath: path];
+ localPath = [_mgr _FILESYSTEMREPRESENTATIONWITHPATH: path];
dir_pointer = _OPENDIR(localPath);
if (dir_pointer)
{
@@ -2117,7 +2131,7 @@
}
/* Name of file to return */
returnFileName = [_mgr
- stringWithFileSystemRepresentation: (const char*)dirbuf->d_name
+ stringWithUnicodeFileSystemRepresentation:dirbuf->d_name
length: 2*wcslen(dirbuf->d_name)];
#else
/* Skip "." and ".." directory entries */
@@ -2164,7 +2178,7 @@
#endif
#endif
{
- if (_STAT((_CCP)[_mgr fileSystemRepresentationWithPath:
+ if (_STAT([_mgr _FILESYSTEMREPRESENTATIONWITHPATH:
_currentFilePath], &statbuf) != 0)
{
break;
@@ -2175,7 +2189,7 @@
_DIR* dir_pointer;
dir_pointer
- = _OPENDIR((_CCP)[_mgr fileSystemRepresentationWithPath:
+ = _OPENDIR([_mgr _FILESYSTEMREPRESENTATIONWITHPATH:
_currentFilePath]);
if (dir_pointer)
{
@@ -2392,8 +2406,8 @@
handler: (id)handler
{
#if defined(__MINGW32__)
- if (CopyFile((_CCP)[self fileSystemRepresentationWithPath: source],
- (_CCP)[self fileSystemRepresentationWithPath: destination], NO))
+ if (CopyFileW([self _FILESYSTEMREPRESENTATIONWITHPATH: source],
+ [self _FILESYSTEMREPRESENTATIONWITHPATH: destination], NO))
{
return YES;
}
Index: Source/NSMessagePortNameServer.m
===================================================================
RCS file: /cvsroot/gnustep/gnustep/core/base/Source/NSMessagePortNameServer.m,v
retrieving revision 1.12
diff -u -r1.12 NSMessagePortNameServer.m
--- Source/NSMessagePortNameServer.m 1 Nov 2005 20:37:34 -0000 1.12
+++ Source/NSMessagePortNameServer.m 4 Nov 2005 20:38:30 -0000
@@ -183,7 +183,11 @@
NSDebugLLog(@"NSMessagePort", @"_livePort: %@", path);
+#ifdef __MINGW32__
+ f = _wfopen([path unicodeFileSystemRepresentation], L"rt");
+#else
f = fopen([path fileSystemRepresentation], "rt");
+#endif
if (!f)
{
NSDebugLLog(@"NSMessagePort", @"not live, couldn't open file (%m)");
@@ -199,14 +203,22 @@
if (stat(socket_path, &sb) < 0)
{
+#ifdef __MINGW32__
+ _wunlink([path unicodeFileSystemRepresentation]);
+#else
unlink([path fileSystemRepresentation]);
+#endif
NSDebugLLog(@"NSMessagePort", @"not live, couldn't stat socket (%m)");
return NO;
}
if (kill(pid, 0) < 0)
{
+#ifdef __MINGW32__
+ _wunlink([path unicodeFileSystemRepresentation]);
+#else
unlink([path fileSystemRepresentation]);
+#endif
unlink(socket_path);
NSDebugLLog(@"NSMessagePort", @"not live, no such process (%m)");
return NO;
@@ -222,7 +234,11 @@
if ((desc = socket(PF_LOCAL, SOCK_STREAM, PF_UNSPEC)) < 0)
{
- unlink([path fileSystemRepresentation]);
+#ifdef __MINGW32__
+ _wunlink([path unicodeFileSystemRepresentation]);
+#else
+ unlink([path fileSystemRepresentation]);
+#endif
unlink(socket_path);
NSDebugLLog(@"NSMessagePort",
@"couldn't create socket, assuming not live (%m)");
@@ -230,7 +246,11 @@
}
if (connect(desc, (struct sockaddr*)&sockAddr, SUN_LEN(&sockAddr)) < 0)
{
- unlink([path fileSystemRepresentation]);
+#ifdef __MINGW32__
+ _wunlink([path unicodeFileSystemRepresentation]);
+#else
+ unlink([path fileSystemRepresentation]);
+#endif
unlink(socket_path);
NSDebugLLog(@"NSMessagePort", @"not live, can't connect (%m)");
return NO;
@@ -264,7 +284,11 @@
return nil;
}
+#ifdef __MINGW32__
+ f = _wfopen([path unicodeFileSystemRepresentation], L"rt");
+#else
f = fopen([path fileSystemRepresentation], "rt");
+#endif
if (!f)
{
NSDebugLLog(@"NSMessagePort", @"can't open file (%m)");
@@ -307,7 +331,11 @@
return NO;
}
+#ifdef __MINGW32__
+ fd = _wopen([path unicodeFileSystemRepresentation], O_CREAT|O_EXCL|O_WRONLY, 0600);
+#else
fd = open([path fileSystemRepresentation], O_CREAT|O_EXCL|O_WRONLY, 0600);
+#endif
if (fd < 0)
{
NSDebugLLog(@"NSMessagePort", @"fail, can't open file (%m)");
@@ -344,7 +372,11 @@
NSDebugLLog(@"NSMessagePort", @"removePortForName: %@", name);
path = [[self class] _pathForName: name];
+#ifdef __MINGW32__
+ _wunlink([path unicodeFileSystemRepresentation]);
+#else
unlink([path fileSystemRepresentation]);
+#endif
return YES;
}
@@ -391,7 +423,11 @@
path = [[self class] _pathForName: name];
+#ifdef __MINGW32__
+ f = _wfopen([path unicodeFileSystemRepresentation], L"rt");
+#else
f = fopen([path fileSystemRepresentation], "rt");
+#endif
if (!f)
return YES;
@@ -404,7 +440,11 @@
if (!strcmp((char*)socket_path, (char*)port_path))
{
- unlink([path fileSystemRepresentation]);
+#ifdef __MINGW32__
+ _wunlink([path unicodeFileSystemRepresentation]);
+#else
+ unlink([path fileSystemRepresentation]);
+#endif
}
return YES;
Index: Source/NSPathUtilities.m
===================================================================
RCS file: /cvsroot/gnustep/gnustep/core/base/Source/NSPathUtilities.m,v
retrieving revision 1.40
diff -u -r1.40 NSPathUtilities.m
--- Source/NSPathUtilities.m 28 Oct 2005 22:21:36 -0000 1.40
+++ Source/NSPathUtilities.m 4 Nov 2005 20:38:32 -0000
@@ -366,15 +366,36 @@
/*
* Function to return the system-wide configuration
*/
+static NSDictionary *systemGNUStepConfig = nil;
+
+void setGNUstepConfig(NSDictionary*conf)
+{
+ [gnustep_global_lock lock];
+ NS_DURING
+ if ([conf objectForKey: @"GNUSTEP_USER_CONFIG_FILE"] == nil)
+ {
+ conf = [[conf mutableCopy] autorelease];
+ [(NSMutableDictionary*)conf setObject: @".GNUstep.conf"
+ forKey: @"GNUSTEP_USER_CONFIG_FILE"];
+ }
+ systemGNUStepConfig = [conf copy];
+ gnustepUserConfigFile
+ = [systemGNUStepConfig objectForKey: @"GNUSTEP_USER_CONFIG_FILE"];
+ NS_HANDLER
+ [gnustep_global_lock unlock];
+ systemGNUStepConfig = nil;
+ [localException raise];
+ NS_ENDHANDLER
+ [gnustep_global_lock unlock];
+}
+
static NSDictionary*
GNUstepConfig(void)
{
- static NSDictionary *config = nil;
-
- if (config == nil)
+ if (systemGNUStepConfig == nil)
{
[gnustep_global_lock lock];
- if (config == nil)
+ if (systemGNUStepConfig == nil)
{
NSMutableDictionary *conf = nil;
@@ -428,15 +449,15 @@
STRINGIFY(GNUSTEP_USER_CONFIG_FILE)];
[conf setObject: tmp forKey: @"GNUSTEP_USER_CONFIG_FILE"];
}
- config = [conf copy];
+ systemGNUStepConfig = [conf copy];
DESTROY(conf);
gnustepUserConfigFile
- = [config objectForKey: @"GNUSTEP_USER_CONFIG_FILE"];
+ = [systemGNUStepConfig objectForKey: @"GNUSTEP_USER_CONFIG_FILE"];
}
NS_HANDLER
{
[gnustep_global_lock unlock];
- config = nil;
+ systemGNUStepConfig = nil;
DESTROY(conf);
[localException raise];
}
@@ -444,7 +465,7 @@
}
[gnustep_global_lock unlock];
}
- return config;
+ return systemGNUStepConfig;
}
/*
@@ -607,7 +628,7 @@
#if defined(__WIN32__)
fprintf(stderr, "The file '%S' is writable by someone other than"
" its owner (permissions 0%lo).\nIgnoring it.\n",
- (const unichar*)[fileName fileSystemRepresentation],
+ [fileName unicodeFileSystemRepresentation],
[attributes filePosixPermissions]);
#else
fprintf(stderr, "The file '%s' is writable by someone other than"
@@ -1029,7 +1050,10 @@
defaultsDir = @GNUSTEP_TARGET_USER_DEFAULTS_DIR;
}
}
- home = [home stringByAppendingPathComponent: defaultsDir];
+ if ([defaultsDir rangeOfString: @":REGISTRY:"].length > 0)
+ home = defaultsDir;
+ else
+ home = [home stringByAppendingPathComponent: defaultsDir];
return home;
}
Index: Source/NSProcessInfo.m
===================================================================
RCS file: /cvsroot/gnustep/gnustep/core/base/Source/NSProcessInfo.m,v
retrieving revision 1.109
diff -u -r1.109 NSProcessInfo.m
--- Source/NSProcessInfo.m 11 Oct 2005 19:09:25 -0000 1.109
+++ Source/NSProcessInfo.m 2 Nov 2005 17:37:27 -0000
@@ -1108,7 +1108,11 @@
extern int _NSLogDescriptor;
int desc;
+#ifdef __MINGW32__
+ desc = _wopen([path unicodeFileSystemRepresentation], O_RDWR|O_CREAT|O_APPEND, 0644);
+#else
desc = open([path fileSystemRepresentation], O_RDWR|O_CREAT|O_APPEND, 0644);
+#endif
if (desc >= 0)
{
if (_NSLogDescriptor >= 0 && _NSLogDescriptor != 2)
Index: Source/NSString.m
===================================================================
RCS file: /cvsroot/gnustep/gnustep/core/base/Source/NSString.m,v
retrieving revision 1.350
diff -u -r1.350 NSString.m
--- Source/NSString.m 23 Oct 2005 14:53:03 -0000 1.350
+++ Source/NSString.m 2 Nov 2005 22:11:46 -0000
@@ -3469,6 +3469,16 @@
static NSFileManager *fm = nil;
+- (const unichar*) unicodeFileSystemRepresentation
+{
+ if (fm == nil)
+ {
+ fm = RETAIN([NSFileManager defaultManager]);
+ }
+
+ return [fm unicodeFileSystemRepresentationWithPath: self];
+}
+
- (const char*) fileSystemRepresentation
{
if (fm == nil)
@@ -3477,6 +3487,15 @@
}
return [fm fileSystemRepresentationWithPath: self];
+}
+
+- (BOOL) getUnicodeFileSystemRepresentation: (unichar*)buffer
+ maxLength: (unsigned int)size
+{
+ if ([self length] > size)
+ return NO;
+ [self getCharacters:buffer];
+ return YES;
}
- (BOOL) getFileSystemRepresentation: (char*)buffer
Index: Source/NSTask.m
===================================================================
RCS file: /cvsroot/gnustep/gnustep/core/base/Source/NSTask.m,v
retrieving revision 1.77
diff -u -r1.77 NSTask.m
--- Source/NSTask.m 11 Oct 2005 19:09:26 -0000 1.77
+++ Source/NSTask.m 28 Oct 2005 20:44:58 -0000
@@ -1085,7 +1085,7 @@
}
lpath = [self _fullLaunchPath];
- wexecutable = (const unichar*)[lpath fileSystemRepresentation];
+ wexecutable = [lpath unicodeFileSystemRepresentation];
args = [[NSMutableString alloc] initWithString: quotedFromString(lpath)];
arg_enum = [[self arguments] objectEnumerator];
@@ -1184,7 +1184,7 @@
1, /* inherit handles */
CREATE_UNICODE_ENVIRONMENT, /* creation flags */
envp, /* env block */
- (const unichar*)[[self currentDirectoryPath] fileSystemRepresentation],
+ [[self currentDirectoryPath] unicodeFileSystemRepresentation],
&start_info,
&procInfo);
NSZoneFree(NSDefaultMallocZone(), w_args);
Index: Source/NSTimeZone.m
===================================================================
RCS file: /cvsroot/gnustep/gnustep/core/base/Source/NSTimeZone.m,v
retrieving revision 1.79
diff -u -r1.79 NSTimeZone.m
--- Source/NSTimeZone.m 11 Oct 2005 19:09:26 -0000 1.79
+++ Source/NSTimeZone.m 28 Oct 2005 20:43:10 -0000
@@ -916,7 +916,7 @@
mode[0] = 'r';
mode[1] = 'b';
mode[2] = '\0';
- file = _wfopen((const unichar*)[path fileSystemRepresentation], mode);
+ file = _wfopen([path unicodeFileSystemRepresentation], mode);
}
#else
file = fopen([path fileSystemRepresentation], "r");
@@ -1342,7 +1342,7 @@
mode[0] = 'r';
mode[1] = 'b';
mode[2] = '\0';
- file = _wfopen((const unichar*)[fileName fileSystemRepresentation], mode);
+ file = _wfopen([fileName unicodeFileSystemRepresentation], mode);
}
#else
file = fopen([fileName fileSystemRepresentation], "r");
Index: Source/objc-load.h
===================================================================
RCS file: /cvsroot/gnustep/gnustep/core/base/Source/objc-load.h,v
retrieving revision 1.2
diff -u -r1.2 objc-load.h
--- Source/objc-load.h 22 May 2005 03:32:14 -0000 1.2
+++ Source/objc-load.h 2 Nov 2005 17:43:53 -0000
@@ -39,23 +39,38 @@
#define LINKER_GETSYMBOL 0
#endif
-extern long objc_load_module(
- const char *filename,
+#ifdef __MINGW32__
+extern long
+objc_load_module (const unichar *filename,
+ FILE *errorStream,
+ void (*loadCallback)(Class, struct objc_category *),
+ void **header,
+ unichar *debugFilename);
+extern long objc_load_modules(
+ unichar *files[],
FILE *errorStream,
- void (*loadCallback)(Class, struct objc_category *),
+ void (*callback)(Class,struct objc_category *),
void **header,
- char *debugFilename);
-
-extern long objc_unload_module(
- FILE *errorStream,
- void (*unloadCallback)(Class, struct objc_category *));
-
+ unichar *debugFilename);
+#else
+extern long
+objc_load_module (const char *filename,
+ FILE *errorStream,
+ void (*loadCallback)(Class, struct objc_category *),
+ void **header,
+ char *debugFilename);
extern long objc_load_modules(
char *files[],
FILE *errorStream,
void (*callback)(Class,struct objc_category *),
void **header,
char *debugFilename);
+#endif
+
+extern long objc_unload_module(
+ FILE *errorStream,
+ void (*unloadCallback)(Class, struct objc_category *));
+
extern long objc_unload_modules(
FILE *errorStream,
Index: Source/objc-load.m
===================================================================
RCS file: /cvsroot/gnustep/gnustep/core/base/Source/objc-load.m,v
retrieving revision 1.23
diff -u -r1.23 objc-load.m
--- Source/objc-load.m 11 Oct 2005 19:09:26 -0000 1.23
+++ Source/objc-load.m 2 Nov 2005 17:40:55 -0000
@@ -55,7 +55,11 @@
#include "dynamic-load.h"
/* Declaration from NSBundle.m */
+#ifdef __MINGW32__
+const unichar *objc_executable_location (void);
+#else
const char *objc_executable_location (void);
+#endif
/* dynamic_loaded is YES if the dynamic loader was sucessfully initialized. */
static BOOL dynamic_loaded;
@@ -101,7 +105,11 @@
static int
objc_initialize_loading(FILE *errorStream)
{
+#ifdef __MINGW32__
+ const unichar *path;
+#else
const char *path;
+#endif
dynamic_loaded = NO;
path = objc_executable_location();
@@ -145,12 +153,21 @@
}
}
+#ifdef __MINGW32__
+long
+objc_load_module (const unichar *filename,
+ FILE *errorStream,
+ void (*loadCallback)(Class, struct objc_category *),
+ void **header,
+ unichar *debugFilename)
+#else
long
objc_load_module (const char *filename,
FILE *errorStream,
void (*loadCallback)(Class, struct objc_category *),
void **header,
char *debugFilename)
+#endif
{
#ifdef NeXT_RUNTIME
int errcode;
@@ -254,10 +271,17 @@
return 0;
}
+#if defined(__MINGW32__)
+long objc_load_modules(unichar *files[],FILE *errorStream,
+ void (*callback)(Class,struct objc_category *),
+ void **header,
+ unichar *debugFilename)
+#else
long objc_load_modules(char *files[],FILE *errorStream,
void (*callback)(Class,struct objc_category *),
void **header,
char *debugFilename)
+#endif
{
while (*files)
{
Index: Source/win32-load.h
===================================================================
RCS file: /cvsroot/gnustep/gnustep/core/base/Source/win32-load.h,v
retrieving revision 1.5
diff -u -r1.5 win32-load.h
--- Source/win32-load.h 15 Jul 2005 22:51:21 -0000 1.5
+++ Source/win32-load.h 2 Nov 2005 17:45:45 -0000
@@ -34,7 +34,7 @@
if no initialization needed.
*/
static int
-__objc_dynamic_init(const char* exec_path)
+__objc_dynamic_init(const unichar* exec_path)
{
return 0;
}
@@ -43,9 +43,9 @@
be used to get information about the loded code.
*/
static dl_handle_t
-__objc_dynamic_link(const char* module, int mode, const char* debug_file)
+__objc_dynamic_link(const unichar* module, int mode, const unichar* unidebug_file)
{
- return LoadLibraryExW((const unichar*)module, 0, 0);
+ return LoadLibraryExW(module, 0, 0);
}
/* Return the address of a symbol given by the name 'symbol' from the module
@@ -68,19 +68,13 @@
return 0;
}
-static char *
-__objc_dynamic_get_symbol_path(dl_handle_t handle, dl_symbol_t symbol)
-{
- return NULL;
-}
-
/* Print an error message (prefaced by 'error_string') relevant to the
last error encountered
*/
static void
__objc_dynamic_error(FILE *error_stream, const char *error_string)
{
- fprintf(error_stream, "%s:%d\n", error_string, GetLastError());
+ fprintf(error_stream, "%s:%ld\n", error_string, GetLastError());
}
/* Debugging: define these if they are available */
cvs server: Diffing Source/Additions
Index: Source/Additions/GSXML.m
===================================================================
RCS file: /cvsroot/gnustep/gnustep/core/base/Source/Additions/GSXML.m,v
retrieving revision 1.85
diff -u -r1.85 GSXML.m
--- Source/Additions/GSXML.m 23 Jul 2005 12:30:21 -0000 1.85
+++ Source/Additions/GSXML.m 28 Oct 2005 20:42:22 -0000
@@ -2576,6 +2576,7 @@
if ([file length] > 0)
{
+/* Should probably use unicodeFileSystemRepresentation on __MINGW32__ but there is no libxml function that expects unicode file names */
ret = xmlNewInputFromFile(ctx, [file fileSystemRepresentation]);
}
else