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

QDir::cleanPath does not handle single-dot (current dir ) consistently

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Done
    • Icon: P3: Somewhat important P3: Somewhat important
    • 5.4.0
    • 4.4.1
    • Core: I/O
    • None
    • eedefa28bd66123f7787e989a4e4bccbb09f20bc

      When using QDir::cleanPath() with path having '.' and '..' in combination with '/' it does not work consistent.

      #include <QtCore>
      
      int main (int argc, char *argv[]) {
          QCoreApplication app (argc, argv);
      
          QString path ="/GeneratedFiles/./and";
          qDebug()<<QDir::cleanPath(path);
          path ="./GeneratedFiles/..";
          qDebug()<<QDir::cleanPath(path);// prints "./GeneratedFiles/..";
      
          path ="./GeneratedFiles/../";
          qDebug()<<QDir::cleanPath(path);// prints "";
          return app.exec ();
      }
      

      Reproducible with Qt 4.4.3 and 4.5 beta on Window Vista.

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

            owolff Oliver Wolff
            smk smk
            Votes:
            1 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved:

                There are no open Gerrit changes