diff --git a/src/corelib/io/qfilesystemengine_win.cpp b/src/corelib/io/qfilesystemengine_win.cpp index dbc6d28846..7741eb4c1e 100644 --- a/src/corelib/io/qfilesystemengine_win.cpp +++ b/src/corelib/io/qfilesystemengine_win.cpp @@ -74,6 +74,8 @@ # define SECURITY_WIN32 # include #else // !Q_OS_WINRT +# include "qstandardpaths.h" +# include "qthreadstorage.h" # include # include # include @@ -1151,6 +1153,18 @@ bool QFileSystemEngine::createDirectory(const QFileSystemEntry &entry, bool crea bool existed = false; if (isDirPath(chunk, &existed) && existed) continue; +#ifdef Q_OS_WINRT + static QThreadStorage dataLocation; + if (!dataLocation.hasLocalData()) + dataLocation.setLocalData(QDir::toNativeSeparators(QStandardPaths::writableLocation(QStandardPaths::DataLocation))); + static QThreadStorage tempLocation; + if (!tempLocation.hasLocalData()) + tempLocation.setLocalData(QDir::toNativeSeparators(QStandardPaths::writableLocation(QStandardPaths::TempLocation))); + // We try to create something outside the sandbox, which is forbidden + // However we could still try to pass into the sandbox + if (dataLocation.localData().startsWith(chunk) || tempLocation.localData().startsWith(chunk)) + continue; +#endif } return false; }