Review Request: Fix KCmdLineArgs so that it doesn't strip the path from argv[0] but still display the appname without path where needed
David Faure
faure at kde.org
Wed Nov 4 00:58:07 GMT 2009
-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
http://reviewboard.kde.org/r/1913/#review2919
-----------------------------------------------------------
Ship it!
Looks good, thanks.
- David
On 2009-10-19 21:14:44, George Kiagiadakis wrote:
>
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> http://reviewboard.kde.org/r/1913/
> -----------------------------------------------------------
>
> (Updated 2009-10-19 21:14:44)
>
>
> Review request for kdelibs.
>
>
> Summary
> -------
>
> This patch makes KCmdLineArgs to use a separate variable to hold the app name (without the path) instead of striping the path from argv[0]. The path in argv[0] might still be useful, for example for use in QCoreApplication::applicationFilePath(). In addition, when striping the path from the app name, use QDir::separator() to make it work correctly on windows.
>
> For the reason why I am doing this, please read http://lists.kde.org/?l=kde-core-devel&m=125560663311741&w=2
>
>
> Diffs
> -----
>
> /trunk/KDE/kdelibs/kdecore/kernel/kcmdlineargs.cpp 1037603
>
> Diff: http://reviewboard.kde.org/r/1913/diff
>
>
> Testing
> -------
>
> I have tested the patch on linux, freebsd and windows using the following testcase:
>
> int main(int argc, char **argv)
> {
> kDebug() << argv[0];
>
> KAboutData a("test", 0, KLocalizedString(), "0.1");
> KCmdLineArgs::init(argc, argv, &a);
> KApplication app(false);
>
> kDebug() << argv[0];
> kDebug() << QCoreApplication::applicationDirPath();
> kDebug() << QCoreApplication::applicationFilePath();
> kDebug() << KCmdLineArgs::appName();
> }
>
> The result is as expected on all platforms: argv[0] doesn't change, appName() returns the application's name without the path and applicationDirPath()/applicationFilePath() return correct paths.
>
>
> Thanks,
>
> George
>
>
More information about the kde-core-devel
mailing list