[Qt-interest] anyone know why QDir::mkpath() isn't static?
Scott Aron Bloom
Scott.Bloom at onshorecs.com
Tue Apr 12 18:19:38 CEST 2011
-----Original Message-----
From: qt-interest-bounces+scott.bloom=onshorecs.com at qt.nokia.com [mailto:qt-interest-bounces+scott.bloom=onshorecs.com at qt.nokia.com] On Behalf Of Thiago Macieira
Sent: Tuesday, April 12, 2011 9:11 AM
To: qt-interest at qt.nokia.com
Subject: Re: [Qt-interest] anyone know why QDir::mkpath() isn't static?
Em terça-feira, 12 de abril de 2011, às 10:55:46, Paul Miller escreveu:
> To use QDir::mkpath() you have to do this:
>
> QDir dir("/the/path/you/want/to/create");
> dir.mkpath(dir.absolutePath());
>
> Seems the argument to mkpath() is redundant, or, since the argument
> overrides the QDir's actual path, the whole constructor is irrelevant.
> Shouldn't it mkpath() be static?
QDir dir("/the/path/you/want/");
dir.mkpath("to/create");
------------------
I have found there are a number of little idiosyncrasies in the QFile, QFileInfo, and QDir code that can be confusing and worst case create a bug.. You just get used to them :)
With mkpath... I would prefer if there was a static as well as a non-static member... I wouldn't even mind if the QDir threw an assert on the static member if the path sent in was relative.
Scott
More information about the Qt-interest-old
mailing list