Different ways to create a directory

David Faure faure at kde.org
Sat Aug 8 18:35:59 BST 2009

On Thursday 30 July 2009, Raphael Kubo da Costa wrote:
> Currently, I can see that a directory can be created with
> QDir::mkdir

Local paths only

> KIO::mkdir

Network transparent, asynchronous

> NetAccess::mkdir (a wrapper around KIO::mkdir for synchronous usage) 

Yep. So: Network transparent, synchronous

> and KStandardDirs::makeDir.

Local paths only, but also creates missing parent directories.
So this one is more comparable to QDir::mkpath().
But it has support for setting the mode_t of the created directories,
while QDir::mkpath() does not.

> Is any of these frowned upon, and is any of them the most recommended?

Depends on what you want to do exactly.

> Aren't they just duplicating functionality available elsewhere?

I don't think so.

David Faure, faure at kde.org, sponsored by Qt Software @ Nokia to work on KDE,
Konqueror (http://www.konqueror.org), and KOffice (http://www.koffice.org).

More information about the kde-core-devel mailing list