Checking if a folder exists (and creating folders) in Qt, C++

Viewed 153761

In Qt, how do I check if a given folder exists in the current directory?
If it doesn't exist, how do I then create an empty folder?

4 Answers

To check if a directory named "Folder" exists use:

QDir("Folder").exists();

To create a new folder named "MyFolder" use:

QDir().mkdir("MyFolder");

Why use anything else?

  mkdir(...);
Related