last modified date of file in Qt resource system

1.3k views Asked by At

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?

1

There are 1 answers

1
TheDarkKnight On BEST ANSWER

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.