Hi,
I'm trying to retrieve the size of a symlink/shortcut (.lnk in Windows) using QFileInfo::size(), but I always end up getting the size of the target of the shortcut.
Assume I have a file 'C:\Temp\testfile.txt' which is of size 653 bytes. Also, I have a shortcut 'testfile.txt.lnk' pointing to the text file. According to Windows, the size of the shortcut (.lnk) is 851 bytes in my case. How shall I do to find this size (851 bytes) with Qt using the path of the shortcut?
Like I said, I thought QFileInfo::size() would to that, but the following example shows that this is not the case (at least not for me):
Output from this test isQt Code:
qDebug() << info1.isSymLink(); qDebug() << info1.absoluteFilePath(); qDebug() << info1.size() << "!!!!! should be 851!"; qDebug() << info1.symLinkTarget(); qDebug() << "-----------------"; qDebug() << info2.isSymLink(); qDebug() << info2.absoluteFilePath(); qDebug() << info2.size();To copy to clipboard, switch view to plain text mode
true
"C:/Temp/testfile.txt.lnk"
653 "!!!!! should be 851!"
"C:/Temp/testfile.txt"
-----------------
false
"C:/Temp/testfile.txt"
653
I use Qt 5.7.0 in Windows.
Grateful for any help.
Bookmarks