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

Yevgen Muntyan muntyan at fastmail.fm
Tue Jun 23 19:46:21 CEST 2009


Yevgen Muntyan wrote:
> Thiago Macieira wrote:
>   
>> Yevgen Muntyan wrote:
>>   
>>     
>>> 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?
>>>     
>>>       
>> We've fixed a couple of issues with renaming temporary files for Qt 4.5.2. 
>> Can you test the current 4.5 sources from Git, or try 4.5.2 as soon as 
>> it's out and let us know if your problem has been fixed?
>>   
>>     
>
> I could not build qt from git, configure said it couldn't find bunch of 
> files, and then qmake compilation
> failed, it couldn't find qstringlist.h. So I'll wait for 4.5.2. 
> Meanwhile I probably need to avoid using
> temporary files.
>   
I just tested the application as it's shipped, and it actually does
work fine. Qt-4.4 doesn't have this problem with QFile::copy().

Yevgen




More information about the Qt-interest-old mailing list