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

QStorageInfo::mountedVolumes() does not always return correct results for SUBSTed drives

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: P4: Low P4: Low
    • None
    • 6.9.1
    • Core: I/O
    • None
    • Windows 10 64-bit
    • Windows

      When I create two drives using command subst then listing the drives with then QStorageInfo does return correct results for some paths but for others it does not. When I create two drives using command subst then listing the drives with then QStorageInfo does return correct results for some paths but for others it does not. Interestingly, when the folder is created using net use X: \\localhost\c$\Users\Vlad  then it works well.

      #include <QDebug>
      #include <QStorageInfo>
      
      int main()
      {
          // Drive X: was created by command SUBST X: C:/Users/Vlad (existing folder!)
          // Drive Y: was created by command SUBST Y: C:/
          // Drive Z: was created by command NET USE Z: \\localhost\c$\Users\Vlad
          // Output:
          // "C:/" true true
          // "X:/" false false     - THIS IS INCORRECT!
          // "Y:/" true true       - this is correct
          // "Z:/" true true       - this is correct 
      
          for (auto info : QStorageInfo::mountedVolumes())
          {
              qDebug() << info.rootPath() << info.isValid() << info.isReady();
          }
      }
       

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

            cnn Qt Core & Network
            vladimir.kraus Vladimir Kraus
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:

                There are no open Gerrit changes