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

QDir::cleanPath does not work as documented

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Not Evaluated
    • Resolution: Invalid
    • Affects Version/s: 5.11.1
    • Fix Version/s: None
    • Component/s: Core: I/O
    • Labels:
      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

            Assignee:
            thiago Thiago Macieira
            Reporter:
            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