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

Windows: QDir::entryList doesn't work for directories that end with '.lnk'

    XMLWordPrintable

Details

    • Bug
    • Resolution: Done
    • P3: Somewhat important
    • 6.2.1, 6.3.0 Alpha
    • 5.15.0
    • Core: I/O
    • None
    • Windows
    • 5
    • 55ab987c9a518f217c02ca1382656ac97c53b307 (qt/qtbase/dev) 520afbbbee5d5f49badc6dbf982d09ded6661bac (qt/qtbase/6.2)
    • Team 2 Foundation_Sprint 43

    Description

      Qt does contain special code paths to resolve .lnk files. Anyhow, some of the code also does apply to directories that end with '.lnk', which is dubious.

      This shows if you try to list the content of a directory whose name ends with '.lnk' via QDir::entryList, QDir::entryInfoList: Even if a file or sub-directory exists the content will be shown empty:

          // create dir
          QString lnkDirPath = parentDir.absoluteFilePath("foo.lnk");
          QDir lnkDir = parentDir.filePath(lnkDirPath);
          Q_ASSERT(lnkDir.exists());
      
          // create file
          QFile f(lnkDir.absoluteFilePath("file.txt"));
          if (!f.open(QIODevice::WriteOnly | QIODevice::Text))
              return 1;
          f.close();
      
          // check if dir lists file
          auto entryList = lnkDir.entryInfoList();
          Q_ASSERT(entryList.size() == 1); // <<<<< asserts
          Q_ASSERT(entryList.first().fileName() == "file.txt");
      

      I'd expect that directories whose name end with '.lnk' are not treated in any way different than normal directories.

      Attachments

        Issue Links

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

          Activity

            People

              heimrich Karsten Heimrich
              kkohne Kai Köhne
              Vladimir Minenko Vladimir Minenko
              Alex Blasche Alex Blasche
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Gerrit Reviews

                  There are no open Gerrit changes