I have problem with the creation of dir with Qt. I would like to create a dir in documents'dir so, I make some things like that :
QString path("C:/Users/Me/Documents/MyApp/profiles/");
Qdir dir = QDir::root();
dir.mkdir(path);
But that doesn't work! I have test with "/" and "\" for the separators but in the two cases that not work.
How I can create my dir?
Thank you.
You can do this:
QDir dir(path);
if (!dir.exists()){
dir.mkdir(".");
}
Instead of using dir.mkdir()
, try to use QDir::mkpath
;
i.e. as dir.mkpath(path);
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