Results 1 to 3 of 3

Thread: QFile rename fails with 4 character extension

  1. #1
    Join Date
    May 2020
    Posts
    9
    Qt products
    Qt5
    Platforms
    Windows Android

    Default QFile rename fails with 4 character extension

    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

  2. #2
    Join Date
    Mar 2009
    Location
    Brisbane, Australia
    Posts
    7,729
    Thanks
    13
    Thanked 1,610 Times in 1,537 Posts
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows
    Wiki edits
    17

    Default Re: QFile rename fails with 4 character extension

    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.

  3. #3
    Join Date
    May 2020
    Posts
    9
    Qt products
    Qt5
    Platforms
    Windows Android

    Default Re: QFile rename fails with 4 character extension

    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

Similar Threads

  1. Rename a lot of files by QFile and QFileSystemModel
    By stereoMatching in forum Newbie
    Replies: 1
    Last Post: 25th July 2012, 19:55
  2. Using rename in Qfile
    By jvwlong in forum Newbie
    Replies: 1
    Last Post: 24th July 2012, 07:51
  3. QFile - QDataStream read and write each character
    By nhs_0702 in forum Qt Programming
    Replies: 2
    Last Post: 4th May 2010, 20:03
  4. QFile or QDir rename()
    By maxpower in forum Qt Programming
    Replies: 2
    Last Post: 23rd January 2009, 18:50
  5. QFile::rename()
    By Bagstone in forum Qt Programming
    Replies: 1
    Last Post: 15th February 2008, 11:53

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.