Check if file can be renamed without copying
If the rename operation fails, Qt will attempt to copy this file's contents to newName, and then remove this file, keeping only newName.
That is undesirable. I need to call
QFile::renameonly if the file can be renamed without copying (e. g. remains on the same disk drive on Windows). Is there a function in Qt that can perform this check (without me having to code it manually for every platform)?
Look at QFSFileEngine. I think its rename should do what you want.
@alex_malyu, it seems that QFSFileEngine has been removed from Qt 5.
No, it's there but it's a private class
I'm not making that distinction. Not in the public API => not available.
I guess I'll use
PathGetDriveNumberon Windows and
staton Unix to get the storage device number/id and compare IDs to determine if 2 paths belong to the same device.