mirror of
https://github.com/gnustep/libs-base.git
synced 2025-04-23 00:41:02 +00:00
Windows path handling fixups by Roland Schwingel
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@17802 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
c4548e04c0
commit
1c51fc5389
4 changed files with 24 additions and 4 deletions
|
@ -4,6 +4,10 @@
|
|||
worked as expected and moved getpwnam() call to where it works.
|
||||
* Source/Additions/GSMime.m: ([GSMimeDocument-rawMimeData:]) bugfix
|
||||
to remove mjime version header from inner documents.
|
||||
* Source/NSBundle.m: Fixup for windows.
|
||||
* Source/NSFileManager.m: Fixup for windows.
|
||||
* Source/NSString.m: Fixup for windows.
|
||||
Windows fixups adapted from patch by <Roland.Schwingel@onevision.de>
|
||||
|
||||
2003-10-07 Richard Frith-Macdonald <rfm@gnu.org>
|
||||
|
||||
|
|
|
@ -603,8 +603,13 @@ _bundle_load_callback(Class theClass, struct objc_category *theCategory)
|
|||
#endif
|
||||
if (_executable_path == nil || [_executable_path length] == 0)
|
||||
{
|
||||
const char *tmp;
|
||||
|
||||
_executable_path =
|
||||
[[[NSProcessInfo processInfo] arguments] objectAtIndex: 0];
|
||||
tmp = [_executable_path UTF8String];
|
||||
_executable_path = [[NSFileManager defaultManager]
|
||||
stringWithFileSystemRepresentation: tmp length: strlen(tmp)];
|
||||
_executable_path =
|
||||
[self _absolutePathOfExecutable: _executable_path];
|
||||
NSAssert(_executable_path, NSInternalInconsistencyException);
|
||||
|
|
|
@ -1823,7 +1823,8 @@ static NSFileManager* defaultManager = nil;
|
|||
{
|
||||
return @"";
|
||||
}
|
||||
if (len >= 2 && ptr[1] == '/' && ptr[0] == '/')
|
||||
if (len >= 2
|
||||
&& ((ptr[1] == '/' && ptr[0] == '/') || (ptr[1] == '\\' && ptr[0] == '\\'))
|
||||
{
|
||||
/*
|
||||
* Convert '//<servername>/' to '~@<servername>/' sequences.
|
||||
|
|
|
@ -3099,8 +3099,9 @@ handle_printf_atsign (FILE *stream,
|
|||
{
|
||||
NSString *homedir;
|
||||
NSRange first_slash_range;
|
||||
unsigned length;
|
||||
|
||||
if ([self length] == 0)
|
||||
if ((length = [self length]) == 0)
|
||||
{
|
||||
return self;
|
||||
}
|
||||
|
@ -3109,6 +3110,15 @@ handle_printf_atsign (FILE *stream,
|
|||
return self;
|
||||
}
|
||||
|
||||
/*
|
||||
* Anything beginning '~@' is assumed to be a windows path specification
|
||||
* which can't be expanded.
|
||||
*/
|
||||
if (length > 1 && [self characterAtIndex: 1] == 0x0040)
|
||||
{
|
||||
return self;
|
||||
}
|
||||
|
||||
first_slash_range = [self rangeOfCharacterFromSet: pathSeps()];
|
||||
|
||||
if (first_slash_range.location != 1)
|
||||
|
@ -3137,7 +3147,7 @@ handle_printf_atsign (FILE *stream,
|
|||
}
|
||||
if (homedir != nil)
|
||||
{
|
||||
return [NSStringClass stringWithFormat: @"%@%@", homedir,
|
||||
return [homedir stringByAppendingPathComponent:
|
||||
[self substringFromIndex: first_slash_range.location]];
|
||||
}
|
||||
else
|
||||
|
@ -3163,7 +3173,7 @@ handle_printf_atsign (FILE *stream,
|
|||
{
|
||||
return @"~";
|
||||
}
|
||||
return [NSStringClass stringWithFormat: @"~/%@",
|
||||
return [@"~" stringByAppendingPathComponent:
|
||||
[self substringFromIndex: [homedir length] + 1]];
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue