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

QDir::cleanPath does not work as documented

    XMLWordPrintable

Details

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

    Description

      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.

       

      Attachments

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

        Activity

          People

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

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes