117258 from nsLocalFileWin put into OS/2 to fix trap

This commit is contained in:
mkaply@us.ibm.com
2002-02-12 22:14:32 +00:00
parent 406502a0c4
commit 2658d6d26f

View File

@@ -736,30 +736,34 @@ nsLocalFile::Create(PRUint32 type, PRUint32 attributes)
// create nested directories to target
unsigned char* slash = _mbschr((const unsigned char*) mResolvedPath.get(), '\\');
// skip the first '\\'
++slash;
slash = _mbschr(slash, '\\');
while (slash)
if (slash)
{
*slash = '\0';
#ifdef XP_OS2
rv = CreateDirectoryA(NS_CONST_CAST(char*, mResolvedPath.get()), NULL);
if (rv) {
rv = ConvertOS2Error(rv);
#else
if (!CreateDirectoryA(NS_CONST_CAST(char*, mResolvedPath.get()), NULL)) {
rv = ConvertWinError(GetLastError());
#endif
if (rv != NS_ERROR_FILE_ALREADY_EXISTS) return rv;
}
*slash = '\\';
// skip the first '\\'
++slash;
slash = _mbschr(slash, '\\');
while (slash)
{
*slash = '\0';
#ifdef XP_OS2
rv = CreateDirectoryA(NS_CONST_CAST(char*, mResolvedPath.get()), NULL);
if (rv) {
rv = ConvertOS2Error(rv);
#else
if (!CreateDirectoryA(NS_CONST_CAST(char*, mResolvedPath.get()), NULL)) {
rv = ConvertWinError(GetLastError());
#endif
if (rv != NS_ERROR_FILE_ALREADY_EXISTS) return rv;
}
*slash = '\\';
++slash;
slash = _mbschr(slash, '\\');
}
}
if (type == NORMAL_FILE_TYPE)
{
PRFileDesc* file = PR_Open(mResolvedPath.get(), PR_RDONLY | PR_CREATE_FILE | PR_APPEND | PR_EXCL, attributes);