Details
-
Suggestion
-
Resolution: Out of scope
-
Not Evaluated
-
None
-
None
-
None
Description
The simple idea to copy a file to a temporary file will not work with the following code:
QFile* source_file;
...
QTemporaryFile* tmp_file = new QTemporaryFile();
tmp_file->open(); tmp_file->close(); //make name
source_file->copy(tmp_file->fileName());
Because tmp_file->open() generates an empty file, which lets QFile.copy() fail.
Solution: allow copy() to already existing files (overwrite mode).