Allow QDir::mkpath() to work on QNX QNet paths

Due to a quirk in the way that QNX's mkdir() implementation reports
return values when the requested pathname is the mountpoint of a
QNet filesystem, the usual recursive directory creation algorithm
used by QDir fails if the destination directory happens to exist
inside QNet.

This is an artificial failure; the desired directory can still
be created with the normal mkdir() algorithm. There just needs to
error handling in place to allow the recursive creation of parents
to recognize this situation.

Change-Id: I350fd9cb39858570032f9146c1154a9287701569
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
This commit is contained in:
Matt Hoosier 2013-09-25 08:22:45 -05:00 committed by The Qt Project
parent 1db9075482
commit 1749bab565

View File

@ -511,7 +511,14 @@ bool QFileSystemEngine::createDirectory(const QFileSystemEntry &entry, bool crea
if (slash) {
const QByteArray chunk = QFile::encodeName(dirName.left(slash));
if (QT_MKDIR(chunk.constData(), 0777) != 0) {
if (errno == EEXIST) {
if (errno == EEXIST
#if defined(Q_OS_QNX)
// On QNX the QNet (VFS paths of other hosts mounted under a directory
// such as /net) mountpoint returns ENOENT, despite existing. stat()
// on the QNet mountpoint returns successfully and reports S_IFDIR.
|| errno == ENOENT
#endif
) {
QT_STATBUF st;
if (QT_STAT(chunk.constData(), &st) == 0 && (st.st_mode & S_IFMT) == S_IFDIR)
continue;