QFile::rename() folder fails by explorer



  • Hi,
    I used QFile::rename(old_foldername, new_foldername) to rename folder in windows. It works ok. But when if file explorer open subfolder of old_foldername, it fails to rename folder. For example, if old_foldername is "C:\myfolder" and if windows file explorer open the foder "C:\myfoder\subfolder", then it could not rename "C:\myfolder" to another name.
    On the other hand, other windows application could rename it without problem. Is it possible to fix it?


  • Qt Champions 2016

    @samdol said in QFile::rename() folder fails by explorer:

    On the other hand, other windows application could rename it without problem. Is it possible to fix it?

    I'm pretty sure that's not true. Please check again. On windows applications (in this case) explorer lock the folders when they open them, so that's why your Qt app is not able to rename the file. It's an OS's filesystem's limitation, and I'm not aware of any workarounds.


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.