* Add support for systems that support unichar file paths (e.g.

Windows).
* Headers/Foundation/NSFileManager.h (-localFromOpenStepPath:,
_openStepPathFromLocal:): New methods.
(NSDirectoryEnumerator): Updated ivars.
* Source/NSFileManager.m: Idem.
(-changeCurrentDirectoryPath, changeFileAttributes:,
currentDirectoryPath, etc): Update for Windows unichar paths.
* Headers/Foundation/NSString.h: (-unicharString,
-localFromOpenStepPath:, _openStepPathFromLocal:): New methods.
* Source/NSString.m: Idem.
* Source/GSFileHandle.m (-initForReadingAtPath:,
-initForWritingAtPath, -initForUpdatingAtPath:): Update for Windows
unichar paths.
* Source/NSData.m (readContentsOfFile, -writeToFile:,
initWithContentsOfMappedFile:): Idem.
* Source/NSTask.m (NSConcreteWindowsTask): Update for Windows
unichar paths.
(Patch from Roland Schwingle <roland.schwingel@onevision.de>)


git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@20502 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
Adam Fedor 2004-12-29 04:21:37 +00:00
parent 0de118ae76
commit a861c353bd
9 changed files with 1171 additions and 801 deletions

View file

@ -2608,6 +2608,31 @@ handle_printf_atsign (FILE *stream,
// Getting C Strings
/**
* Returns a pointer to a null terminated string of 16-bit unichar
* The memory pointed to is not owned by the caller, so the
* caller must copy its contents to keep it. Raises an
*/
- (const unichar*) unicharString
{
NSData *returnData = nil;
int len = [self length];
unichar buf[64];
unichar *uniStr = (len < 64) ? buf :
NSZoneMalloc(NSDefaultMallocZone(), (len+1) * sizeof(unichar));
if (uniStr != NULL)
{
[self getCharacters:uniStr];
uniStr[len] = L'\0';
returnData = [NSData dataWithBytes:uniStr length:(len+1)*sizeof(unichar)];
if (uniStr != buf)
NSZoneFree(NSDefaultMallocZone(), uniStr);
return ((const unichar*)[returnData bytes]);
}
return(NULL);
}
/**
* Returns a pointer to a null terminated string of 8-bit characters in the
* default encoding. The memory pointed to is not owned by the caller, so the
@ -3195,6 +3220,39 @@ handle_printf_atsign (FILE *stream,
return [fm fileSystemRepresentationWithPath: self];
}
/**
* Converts this string, which is assumed to be a path in Unix notation ('/'
* is file separator, '.' is extension separator) to a string path expressed
* in the convention for the host operating system.
*/
- (NSString*) localFromOpenStepPath
{
static NSFileManager *fm = nil;
if (fm == nil)
{
fm = RETAIN([NSFileManager defaultManager]);
}
return [fm localFromOpenStepPath: self];
}
/**
* Converts this string, which is assumed to be a path in the convention
* for the host operating system to a string path expressed
* in Unix notation ('/' is file separator, '.' is extension separator).
*/
- (NSString*) openStepPathFromLocal
{
static NSFileManager *fm = nil;
if (fm == nil)
{
fm = RETAIN([NSFileManager defaultManager]);
}
return [fm openStepPathFromLocal: self];
}
/**
* Converts this string, which is assumed to be a path in Unix notation ('/'
@ -3212,6 +3270,7 @@ handle_printf_atsign (FILE *stream,
return YES;
}
/**
* Returns a string containing the last path component of the receiver.<br />
* The path component is the last non-empty substring delimited by the ends