QDir::mkpath shouldn't fail if parent directory denies access

The fix for QTBUG-30046 introduced this regression on Windows, which
meant that it became impossible to create a directory anywhere under
c:\Users for example, because each user only has permission to see
his own directory.

Task-number: QTBUG-32314
Change-Id: I1b35433265934d4978d4b0c23a946c3f920c710d
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@digia.com>
This commit is contained in:
Shawn Rutledge 2013-07-11 09:48:07 +02:00 committed by The Qt Project
parent 5ec3b2826b
commit 001b80305a

View File

@ -1049,7 +1049,8 @@ bool QFileSystemEngine::createDirectory(const QFileSystemEntry &entry, bool crea
if (slash) {
QString chunk = dirName.left(slash);
if (!mkDir(chunk)) {
if (GetLastError() == ERROR_ALREADY_EXISTS) {
const DWORD lastError = GetLastError();
if (lastError == ERROR_ALREADY_EXISTS || lastError == ERROR_ACCESS_DENIED) {
bool existed = false;
if (isDirPath(chunk, &existed) && existed)
continue;