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

QDir breaks windows 8.3 paths in long paths strings

    XMLWordPrintable

Details

    • Bug
    • Resolution: Won't Do
    • Not Evaluated
    • None
    • 5.15.2
    • Core: I/O
    • None
    • Windows

    Description

      I have a path in a QString : \\?\C:\Users\OLIVIE~1.BAR\ONEDRI~1\DOCUME~2
      SOE643~1

      This was constructed from a normal path, prefixed by
      \\\\?
      , then passed to GetShortPathNameW (to be able to get the 8.3 version of a path longer than MAX_PATH)

      That Path, pasted in the windows explorer, is valid. Note how the 8.3 format is different than in regular paths, (folder SoilPolutionxxx should have been named something like SOILPO~3.)

      But then i do:

      QDir dir(path);
      dir.setFilter(QDir::NoDotAndDotDot | QDir::Hidden | QDir::Dirs);
      entries = dir.entryInfoList();
      for (int i = 0, n = entries.count(); i < n; ++i)
      {
        const QFileInfo& entry = entries.at(i);
        QString subdir = entry.absoluteFilePath();
        ....

      and subdir is now C:\Users\OLIVIE~1.BAR\ONEDRI~1\DOCUME~2\SOE643~1 (i guess something removes the \\?\ when path is not long?). Which is now an invalid path

      Attachments

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

        Activity

          People

            cnn Qt Core & Network
            bartoli Olivier BARTHELEMY
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes