PDA

View Full Version : QFile rename fails with 4 character extension



bclay1297@gmail.com
26th May 2020, 20:21
This ia an apparent bug in Qt

I can use QFile to create and open files with 4 characters in the extension but when I receive a temp file and try to rename it using 4 characters in the extension the rename fails. If I truncate the extension to 3 character rename works. This of course causes a problem in the client server world where the client still uses the full path name and the server had to truncate the name.

OS: windows 10 Build env: Visual Studio 2017 - Qt5.12.

Bruce

ChrisW67
26th May 2020, 23:16
Post a minimal, self-contained program that reproduces the error.
If by "temp file" you mean a file managed by QTemporaryFile, then renaming it will likely fail because QTemporaryFile maintains the file in an open state and Windows does not like renaming open files.

bclay1297@gmail.com
29th May 2020, 13:29
Chris:
Thanks for your reply. I worked through a short example as you requested but it did not replicate the problem. I am thinking at this point it is a timing issue getting data from the remote size and closing the file before the rename. I am not sure how to mark this issue as closed but I think it is. I will start a new thread with the issue that I think is actually causing this problem. The http server is not signaling finished so I used the message header size and looked for that many bytes but the TCPsocket kept getting more data

Thanks again

Bruce