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

QFileInfo::size() and QFile::size() returns link target size for windows .lnk files. This contradicts the documentation

    XMLWordPrintable

Details

    • Bug
    • Resolution: Unresolved
    • P4: Low
    • None
    • 5.4.1
    • Core: I/O
    • None
    • msvc 2012 amd64
      qt 5.4.1
      win 8

    Description

      QFile::size() and QFileInfo::size() both return the size of the link's target and not of the .lnk file itself.

      QFile::open() does however open the .lnk file.

      The attatched sample app shows the problem:

      Output:

      path : "C:/Users/Kim/Desktop/wat.exe.lnk"
      symlink: true
      target : "C:/wat.exe"
      QFileInfo.size : 1018368 // this is wrong
      stat.st_size : 716
      QFile.readall.size: 716
      QFile.size : 1018368 // this is wrong

      path : "C:/wat.exe"
      symlink: false
      target : ""
      QFileInfo.size : 1018368
      stat.st_size : 1018368
      QFile.readall.size: 1018368
      QFile.size : 1018368

      Attachments

        Issue Links

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

          Activity

            People

              smd Jan Arve
              kimbs Kim Bowles Sørhus
              Votes:
              2 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:

                Gerrit Reviews

                  There are no open Gerrit changes