зеркало из https://github.com/mozilla/pjs.git
fix problems accessing local folders with unc path local dirs, r=bienvenu, sr=mscott, patch by slavek.banko@axis.cz 133153
This commit is contained in:
Родитель
c542f8d67e
Коммит
e9b6da637b
|
@ -467,8 +467,18 @@ void nsFileSpecHelpers::MakeAllDirectories(const char* inPath, int mode)
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
// move after server name and share name in UNC path
|
||||||
|
if (pathCopy[0] == '/' &&
|
||||||
|
currentEnd == currentStart+kSkipFirst)
|
||||||
|
{
|
||||||
|
*currentEnd = '/';
|
||||||
|
currentStart = strchr(pathCopy+2, kSeparator);
|
||||||
|
currentStart = strchr(currentStart+1, kSeparator);
|
||||||
|
currentEnd = strchr(currentStart+1, kSeparator);
|
||||||
|
if (currentEnd)
|
||||||
|
*currentEnd = '\0';
|
||||||
|
}
|
||||||
spec = nsFilePath(pathCopy, PR_FALSE);
|
spec = nsFilePath(pathCopy, PR_FALSE);
|
||||||
|
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
spec = nsFilePath(pathCopy, PR_FALSE);
|
spec = nsFilePath(pathCopy, PR_FALSE);
|
||||||
|
@ -728,7 +738,8 @@ nsFilePath::nsFilePath(const nsString& inString, PRBool inCreateDirs)
|
||||||
// Make canonical and absolute.
|
// Make canonical and absolute.
|
||||||
nsFileSpecHelpers::Canonify(mPath, inCreateDirs);
|
nsFileSpecHelpers::Canonify(mPath, inCreateDirs);
|
||||||
#if defined(XP_WIN) || defined(XP_OS2)
|
#if defined(XP_WIN) || defined(XP_OS2)
|
||||||
NS_ASSERTION( mPath[1] == ':', "unexpected canonical path" );
|
NS_ASSERTION( mPath[1] == ':' || (mPath[0] == '\\' && mPath[1] == '\\'),
|
||||||
|
"unexpected canonical path" );
|
||||||
nsFileSpecHelpers::NativeToUnix(mPath);
|
nsFileSpecHelpers::NativeToUnix(mPath);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
|
@ -153,6 +153,9 @@ void nsFileSpecHelpers::NativeToUnix(nsSimpleCharString& ioPath)
|
||||||
if (strstr(cp, ":\\") == cp)
|
if (strstr(cp, ":\\") == cp)
|
||||||
*cp = '|'; // absolute path
|
*cp = '|'; // absolute path
|
||||||
else
|
else
|
||||||
|
if (cp[0] == '\\') // unc path
|
||||||
|
cp--;
|
||||||
|
else
|
||||||
temp[0] = '\0'; // relative path
|
temp[0] = '\0'; // relative path
|
||||||
|
|
||||||
// Convert '\' to '/'
|
// Convert '\' to '/'
|
||||||
|
|
Загрузка…
Ссылка в новой задаче