QFile :: delete does not delete the file?

Having a weird problem trying to delete the file I just uploaded with Qt.

My code is:

QString location = "/path/to/app/Application.app"; QFile *rmFile = new QFile(location); rmFile->remove(); 

The file is not deleted.

Any ideas what could be wrong?

+6
source share
1 answer

If this is a directory, apparently you want to use the following API with Qt 5:

bool QDir :: removeRecursively ()

unlike QFile . So you would write something like this:

 QString location = "/path/to/app/Application.app"; QDir *rmDir = new QDir(location); rmDir->removeRecursively(); 

Note that I personally would not use the heap object just for this. A stack object will suffice in this simple case.

+7
source

All Articles