Different ways to create a directory

Raphael Kubo da Costa kubito at gmail.com
Sat Aug 8 23:04:20 BST 2009


2009/8/8 David Faure <faure at kde.org>:
> 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.

Regarding KStandardDirs::makeDir, should it be considered a bug that
when part of the specified path exists as a file (or anything but a
directory) it doesn't fail?




More information about the kde-core-devel mailing list