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

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

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Done
    • Icon: P2: Important P2: Important
    • 6.3.0 Alpha
    • 5.15.1
    • Core: I/O
    • None
    • Windows 10 64-bit
    • Windows
    • 5
    • 71652ad4bf7b4cfe35473c3f93213c16e7653135 (qt/qtbase/dev) c2f5535cbb257f54dcdd8db2dc2c1d35230dce97 (qt/qtbase/6.2)
    • Team 2 Foundation_Sprint 43, Team 2 Foundation_Sprint 44

      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.

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

            heimrich Karsten Heimrich
            vladimir.kraus Vladimir Kraus
            Vladimir Minenko Vladimir Minenko
            Alex Blasche Alex Blasche
            Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

              Created:
              Updated:
              Resolved:

                There are no open Gerrit changes