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

QDir::cleanPath does not work as documented

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Invalid
    • Icon: Not Evaluated Not Evaluated
    • None
    • 5.11.1
    • Core: I/O
    • None

      Using QDir:::cleanPath on Windows file names does not results in expected path according to documention, e.g

      qDebug() << QString("C:/foo/bar: %0").arg(QDir::cleanPath("C:/foo/bar"));
      qDebug() << QString("C:\foo\bar: %0").arg(QDir::cleanPath("C:\foo\bar"));
      qDebug() << QString("C:\\foo\\bar: %0").arg(QDir::cleanPath("C:\\foo\\bar"));
      

      shows this output on linux machine

      "C:/foo/bar: C:/foo/bar"
      "C:\foo\bar: C:\foo\bar"
      "C:\\foo\\bar: C:\\foo\\bar"
      

      ...and this output on windows machine

      "C:/foo/bar: C:/foo/bar"
      "C:\foo\bar: C:\foo\bar"
      "C:\\foo\\bar: C:/foo/bar"
      

      In the documentation QDir::cleanPath is explained like this:

      Returns path with directory separators normalized (converted to "/") and redundant ones removed, and "."s and ".."s resolved (as far as possible).

      This is obviously not true and confusing.

       

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

            thiago Thiago Macieira
            chris984sf Christian Stepanik
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved:

                There are no open Gerrit changes