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

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

    XMLWordPrintable

Details

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

    Description

      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.

      Attachments

        Issue Links

          Activity

            People

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

              Dates

                Created:
                Updated:
                Resolved: