Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

last modified date of file in Qt resource system

Normally you can get last modified date easily with QFileInfo::lastModified(). However this doesn't work when a file inside Qt's resource system is used

QFileInfo resourceInfo("://resource.txt");
qDebug() << resourceInfo.lastModified().toString() // returns ""

Is there a possibility to find out the last modified date without temporarily copying the file from the resources to the file system?

like image 634
Hedge Avatar asked Oct 15 '25 14:10

Hedge


1 Answers

When you add a file to a resource, it's compiled into the final executable binary, so there is no concept of a file as there is in the filesystem, which is why lastModified doesn't return a value.

like image 65
TheDarkKnight Avatar answered Oct 17 '25 04:10

TheDarkKnight



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!