Regarding QCoreApplication::applicationDirPath() and stripping the path from argv[0] in KCmdLineArgs

George Kiagiadakis at
Thu Oct 15 13:24:16 BST 2009

On Thu, Oct 15, 2009 at 3:12 PM, Johannes Sixt <j.sixt at> wrote:
> David Faure schrieb:
>> $ konqueror --help
>> Usage: konqueror [Qt-options] [KDE-options] [...]
>> shows "konqueror", not the internal appname (from kcomponentdata, could be
>> different in some cases I guess), nor the full path to konqueror.
> Side note: This form of invocation does not add the full path to argv[0]!!
> You would have to run
>   $ /usr/bin/konqueror --help
> to demonstrate that the path is really stripped.
> For this reason, I doubt that using QCoreApplication::applicationDirPath()
> will make a difference, unless FreeBSD offers some other method to derive
> the application path and if QCoreApplication uses that method.

If we don't strip the path, then
QCoreApplication::applicationDirPath() has quite good chances of
reporting the correct path. There are a few corner cases though where
it cannot report a correct path, but it's still better to use that
instead of just looking in $PATH, which has less chances of

More information about the kde-core-devel mailing list