PDA

View Full Version : Cannot copy js file from resource to file system



kalma
1st January 2015, 12:53
Hi
I got the following code to copy some resource embedded files to file system.
It works fine with "css" and "htm" files but not with a "js" file (size 480kb), no errors issued but only the file name is there with size =0; what is wrong here?
Thanks.



QFile file("jscript.js");
if (!file.open(QIODevice::ReadOnly | QIODevice::Text)) {
QMessageBox::information(this, "", tr("Unable to open file"), file.errorString());
return;
}
if(!file.copy(":/scripts/jscript.js", "F:\\....\\jscript.js")
QMessageBox::information(this, "", file.errorString());

anda_skoa
1st January 2015, 16:10
Is this you actual code?
How is trying to open the jscript.js file for reading related to the copying of the resource file to disk?

Line 7 doesn't make any sense, the static copy() method used in line 6 cannot affect the file instance "file".

Cheers,
_