Copying files from qrc suddenly stopped working
-
Hi, I'm trying to copy 2 files from a resource (qrc). It was working fine, untill I changed the path where I was originally copying the files to. I tried changing it back, but that also stopped working. I haven't changed anything anywhere, just the destination path.
Here's what I have:QString dir = getUserPath() + "/AppData/Local/Temp/Sucharek/"; QDir createTempFolder; createTempFolder.mkdir(dir); qDebug() << QFile::copy(":/files/drivers.zip", dir + "drivers.zip"); //returns false, the other one too QFile::copy(":/files/platform-tools.zip", dir + "platform-tools.zip");
I have checked the spelling, the path, tried changing it to a different destination path, still returns false and doesn't work.
Edit: The folder in specified path does exist. -
Check if ``:/files/platform-tool.zip` really exists. Also use the non-static version of QFile::copy() and check the error string afterwards.
-
Check if ``:/files/platform-tool.zip` really exists. Also use the non-static version of QFile::copy() and check the error string afterwards.
Hi @Christian-Ehrlicher,
:/files/platform-tools.zip
and the other one exists:
I used the non-static version and QFile returned
Cannot open :/files/platform-tools.zip for input
. Once again, I checked the spelling, paths, they do exist.
The commands I'm using:
QFile file(":/files/platform-tools.zip"); file.copy(dir + "platform-tools.zip"); qDebug() << file.errorString();
-
Hi,
Did you add a prefix or an alias to that file ?
-
@Sucharek
If nothing else is working, did you do a full clean delete and rebuild? Just to make sure the resources are properly compiled into the executable right.