bug-gnustep
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

mingw: wrong behaviour in path manipulating methods


From: Michael Scheibler
Subject: mingw: wrong behaviour in path manipulating methods
Date: Thu, 15 Mar 2001 14:39:51 +0100

Sorry, strip the "file:" which was added by my silly mail client.

Michael

----- Original Message -----
From: "Michael Scheibler" <michael.scheibler@onevision.de>
To: <bug-gnustep@gnu.org>
Sent: Thursday, March 15, 2001 2:18 PM
Subject: mingw: wrong behaviour in path manipulating methods


>
>
> NSString's path manipulation methods always assume that two path
separators
> together have to be stripped to one, but on Windows it is correct to use
> \\server\path\file.ext  (or file://server/path/file.ext on MinGW)
> I found three methods where it is wrongly stripped and altered them:
>
>
> 1. stringByStandardizingPath
>
> if (r.location + r.length + 1 <= length
>    && pathSepMember((*caiImp)(s, caiSel, r.location + 1)) == YES)
>   {
> > #if defined(__MINGW__)
> >    if (r.location)
> >      {
> >        [s deleteCharactersInRange: r];
> >      }
> >    else
> >      {
> >        r.location++;
> >      }
> > #else
>    [s deleteCharactersInRange: r];
> > #endif /* (__MINGW__) */
>  }
>
>
> 2. isAbsolutePath
>
> #if defined(__MINGW__)
>   if ([self indexOfString: @":"] == NSNotFound)
>     {
>       const char *cpath = [self fileSystemRepresentation];
>       if (isalpha(cpath[0]) && cpath[1] == ':')
>         return YES;
>       else
> <       return NO
> >       return (cpath[0] == cpath[1] && (cpath[0] == '/' || cpath[0] ==
> '\\'));
>     }
>   else
>     return YES;
> #else
>
>
>
> 3. stringByAppendingPathComponent
>
>   if (length > 0)
>     {
> > #if defined(__MINGW__)
> > #define _PATH_SEARCH_END 1
> > #else
> > #define _PATH_SEARCH_END 0
> > #endif
>       aLength = length - 1;
> <       while (aLength > 0)
> >       while (aLength > _PATH_SEARCH_END)
> > #undef _PATH_SEARCH_END
>  {
>    if (pathSepMember(buf[aLength]) == YES)
>      {
>        if (pathSepMember(buf[aLength-1]) == YES)
>   {
>     unsigned pos;
>
>
>
> Michael
>
>
> _______________________________________________
> Bug-gnustep mailing list
> Bug-gnustep@gnu.org
> http://mail.gnu.org/mailman/listinfo/bug-gnustep
>




reply via email to

[Prev in Thread] Current Thread [Next in Thread]