Having a strange problem when trying to remove a file i just downloaded with Qt.
My code:
QString location = "/path/to/app/Application.app";
QFile *rmFile = new QFile(location);
rmFile->remove();
File is not being removed.
Any ideas what could be wrong?
If it is a directory as it seems to be, you wish to use the following API with Qt 5:
bool QDir::removeRecursively()
as opposed to QFile
. Therefore, you would be writing something like this:
QString location = "/path/to/app/Application.app";
QDir *rmDir = new QDir(location);
rmDir->removeRecursively();
Note that I would not personally use a heap object just for this. Stack object would suffice in this simple case.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With