Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-85997

QDir::mkpath() does not return true for existing drive

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Reported
    • Priority: P2: Important
    • Resolution: Unresolved
    • Affects Version/s: 5.15.1
    • Fix Version/s: None
    • Component/s: Core: I/O
    • Labels:
      None
    • Environment:
      Windows 10 64-bit
    • Platform/s:
      Windows

      Description

      Documentation says that if a dir exists, then `QDir::mkpath(path)` should return `true`. This however does not work for drives.

      #include <QDebug>
      #include <QDir>
      
       int main()
      {
          qDebug() << QDir().mkpath("C:/Windows"); // returns true
          qDebug() << QDir().mkpath("C:/"); // returns false
      }
      

      This hurts applicability. I cannot write `QDir().mkpath(parentDir);` to ensure that `parentDir` either exists or is created, unless I check beforehand whether the `parentDir` is a drive or a plain dir.

        Attachments

        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

          Activity

            People

            Assignee:
            thiago Thiago Macieira
            Reporter:
            vladimir.kraus Vladimir Kraus
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Dates

              Created:
              Updated:

                Gerrit Reviews

                There are no open Gerrit changes