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

Differing behavior for cdUp on non-existent directory under Windows

    XMLWordPrintable

Details

    • eedefa28bd66123f7787e989a4e4bccbb09f20bc

    Description

      The following code:

      int main()
      {
          QDir dir("NotYetCreatedDirectory");
          qDebug() << dir.absolutePath();
          bool result = dir.cdUp();
          qDebug() << result; // false
          qDebug() << dir.absolutePath();
          return 0;
      }
      

      When run on Windows with a non-existent directory, the call to cdUp returns true and the subsequent call to absolutePath() moves up on directory.

      When called on Linux with a non-existent directory, the call to cdUp is false, and the second call to absolutePath does not move up one level.

      When called on Linux with an existing directory, the call to cdUp returns true and the subsequent call to absolutePath has moved up one level.

      Internally, the cdUp call is calling a cd("NotYetCreatedDirectory/.."), and, as this directory does not exist, the call to "NYCD/.." also fails. Whilst this is correct from the point of view on the Linux file-system, this is not expected behavior.

      I've tested this on 4.8.0 and 5.3.0, and it's the same in both, and presumably most of the versions in between.

      Attachments

        Issue Links

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

          Activity

            People

              owolff Oliver Wolff
              reworled Rebecca Worledge
              Votes:
              1 Vote for this issue
              Watchers:
              6 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Gerrit Reviews

                  There are no open Gerrit changes