简体   繁体   English

Qt资源系统中文件的最后修改日期

[英]last modified date of file in Qt resource system

Normally you can get last modified date easily with QFileInfo::lastModified(). 通常,您可以使用QFileInfo :: lastModified()轻松获得上次修改日期。 However this doesn't work when a file inside Qt's resource system is used 但是,当使用Qt资源系统中的文件时,这不起作用

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? 是否有可能找到上次修改日期而不将文件从资源临时复制到文件系统?

当您将文件添加到资源时,它会被编译为最终的可执行二进制文件,因此文件系统中没有文件的概念,这就是为什么lastModified不返回值。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM