Check if file can be renamed without copying
-
QFile::rename
description says: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::rename
only 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.
-
Look at QFSFileEngine. I think its rename should do what you want.
@alex_malyu, it seems that QFSFileEngine has been removed from Qt 5.
-
Hi,
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 usePathGetDriveNumber
on Windows andstat
on Unix to get the storage device number/id and compare IDs to determine if 2 paths belong to the same device.