logo       

Re: Different ways to create a directory: msg#00410

kde-devel

Subject: Re: Different ways to create a directory

Am Donnerstag 30 Juli 2009 21:39:14 schrieb Raphael Kubo da Costa:
> Hi there,
>
> Currently, I can see that a directory can be created with QDir::mkdir,
> KIO::mkdir, NetAccess::mkdir (a wrapper around KIO::mkdir for
> synchronous usage) and KStandardDirs::makeDir.
>
> Is any of these frowned upon, and is any of them the most recommended?
> What's the purpose of KStandardDirs::makeDir and other methods such as
> exists and checkAccess? Aren't they just duplicating functionality
> available elsewhere?

It depends on your use case.

QDir::mkdir should be the right thing if you want a Qt-only application or
only need to manipulate the local file system.

KIO::mkdir is the right choice for KDE-integrated file managers (or similar)
which need to be able to create directories on remote and special file
systems.

KIO::NetAccess::mkdir is the synchronous counterpart of KIO::mkdir. See the
detailed class description of KIO::NetAccess (at [1]) for details.

KStandardDirs::makeDir is something you hardly ever have to use. It operates
only on the KStandardDirs areas in the file system, which is mostly use as a
_file_ storage (and I for one never had to manually create directories there,
this is usually done inside QFile and friends).

Greetings
Stefan

[1]
http://api.kde.org/4.x-api/kdelibs-apidocs/kio/html/classKIO_1_1NetAccess.html

Attachment: signature.asc
Description: This is a digitally signed message part.


>> Visit http://mail.kde.org/mailman/listinfo/kde-devel#unsub to unsubscribe <<
Google Custom Search

News | Mail Home | sitemap | FAQ | advertise