QFile::exists and Resource files
-
Hi all,
I have the following .qrc file:
@<RCC>
<qresource prefix="/MYRES"><file>DLLs.zip</file>
</qresource>
</RCC>@In the DLLs.zip file I have several .dll files, lets say a.dll, b.dll, c.dll...
Now I need to check if the expected .dll files are in fact in the zip file. So what I did was:
@bool exists = QFile::exists(":/MYRES/DLLs.zip/a.dll");@
Now I also need to do something with the file, so I changed the previous code to:
@QFile a(":/MYRES/DLLs.zip/a.dll");
if(a.exists())
{
// Do something with the file
}if(a.open(QIODevice::ReadOnly))
{
// Do something with the file
}
@Contrary to what would be expected, a.exists returns false, but a.open returns true. It seems kind of weird that I can open a file that does not exist!
Can someone tell me why this happens? Could it be a Qt bug?
-
Hi,
AFAIK, you have a pretty unusual use case here. Using a compressed file to be included in the resources that are themselves already compressed in the same format. I'd say that it might be pure luck that it's working like that.
However to ensure that what you do is correct and if there's a bug somewhere, you should rather ask this on the interest mailing list. You'll find there Qt's developers/maintainers. This forum is more user oriented