get the real path of a resource file
Hi,
is it possible to get the real path of a file that is added to the project with Qt's resource system?
Namely I have "test.qrc" added to the project and a file in that that can be referred with ":/res/file.txt" but this is of course not the real path in the file system. Now the class QFile can handle with the problem (would be dissapointing otherwise... :) ) but I can't give this string for example to an std::ifstream or it is not enough information for otput logs etc.
Re: get the real path of a resource file
I don't know whether this works, but it just might:
QDir::absoluteFilePath ( const QString & fileName )
Re: get the real path of a resource file
Resources are compiled in the executable (or exits as external binary file containing ALL files specified in QRC). So I don't think that You can use this with standard file system mechanism.
Re: get the real path of a resource file
I tried QFileINfo's absoluteFilePath, but it returns also :/res/file.txt
I have the bad feeling that unfortunatelly Lesiok is right.
Re: get the real path of a resource file
Lesiok is absolutely right. There is no file on the (deployed) file system corresponding to ":/res/file.txt". If you need that the be the case then don't use the resources system, or copy the data from the resource system to a dynamically allocated temporary file for external consumption.
Re: get the real path of a resource file