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

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

On Thu, Oct 15, 2009 at 2:57 PM, David Faure <faure at> wrote:
> On Thursday 15 October 2009, George Kiagiadakis wrote:
>> Maybe we could have a
>> separate variable with the stripped argv[0] if it is needed for some
>> purpose and pass the original one to QApplication?
> Yep, sounds like a solution. For "some purpose", see KCmdLineArgs::appName,
> KCmdLineArgs::usageError, KCmdLineArgs::usage. Basically all uses of argv[0]
> except when passing it to Qt.

Ok, I see... thanks.

> KCmdLineArgs::init() is strange, it seems to do the opposite of what Waldo's
> commit was about, it uses the KAboutData appName as argv[0], this needs
> investigation.

This only happens in the KCmdLineArgs::init(const KAboutData* ab)
overloaded member, not in the KCmdLineArgs::init(int _argc, char
**_argv, const KAboutData *_about, StdCmdLineArgs stdargs) which is
what people mostly use.

Btw, this code that strips the path is wrong on windows, which has '\'
as a dir separator...
I'll try to make a patch for both issues and post it on reviewboard.


More information about the kde-core-devel mailing list