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

QDir and QFileInfo inconsistency in system drives

    XMLWordPrintable

Details

    • Bug
    • Resolution: Invalid
    • P3: Somewhat important
    • None
    • 5.8.0
    • Core: I/O
    • None

    Description

      QDir::rootPath() is returning low cased drive letter while QDir::drives() return list of QFileInfo where path() return upper cased drive.
      While the file system is not case sensitive, that's still is problematic because it can make unit testing or path comparison wrong.
      Qt Api should not change the given drive letter case, ie, if I give it a lower "c", then I expect Qt api to not change it when using path or absolutePath (or any other file api).
      I also expect that root() / rootPath() have same case than their drives() equivalent.

      Test case:

          foreach (const QFileInfo &fi, QDir::drives()) {
              qWarning()
                  << fi.path()
                  << QDir::rootPath()
                  << QDir::root().path()
                  << QFileInfo(QSL("c:/")).path()
                  << QFileInfo(QSL("c:/")).absolutePath()
              ;
          }
      

      Output:

      "C:/" "c:/" "c:/" "c:/" "C:/"
      "Z:/" "c:/" "c:/" "c:/" "C:/"

      Attachments

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

        Activity

          People

            thiago Thiago Macieira
            filipe.azevedo Filipe Azevedo
            Votes:
            1 Vote for this issue
            Watchers:
            4 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes