[Qt-interest] QFile::remove() fails on Windows Vista

Yevgen Muntyan muntyan at fastmail.fm
Mon Jun 22 05:00:22 CEST 2009


Hey,

I have a problem with QFile::rename: it fails when it tries to remove the 
temporary file it uses, because DeleteFileW() fails inside 
QFSFileEngine::remove(). My code is roughly the following:

QFile source(":/gap/ggap.g");
source.copy("C:/Users/muntyan/AppData/Local/Temp/ggap-000025cb/ggap.g")

The copy() call here fails. 
"C:/Users/muntyan/AppData/Local/Temp/ggap-000025cb" directory is created 
with QDir::mkdir(), and I do have permissions to delete files from it, and I 
can delete files from it in explorer. The temporary files qt_temp.XXXXXX are 
not read-only, so DeleteFile() isn't supposed to fail. But it does!

Any idea what's going on and how to rename files so that it works on Vista?

Thanks!
Yevgen




More information about the Qt-interest-old mailing list