PDA

View Full Version : QDir mkpath



yazwas
28th August 2009, 18:05
Hello All,

I'm trying to create a directory structure using the following code, but it sometimes fails, I would like to know why?

QDir dir;
bool ok = dir.mkpath(path); //this function creates the path, with all its necessary parents;

if(!ok)
{
//error message, could not create the required directory structure!
QMessageBox::critical(this, tr("Error!"), tr("Error creating directory structure"));
return;
}

How can I get the reason for mkpath returning false, what is the function that I need to call to figure out what was the problem?

Thanks

Lykurg
28th August 2009, 22:21
Look at the value "path". I strongly think, your path is wrong/not well formated.