[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-core-devel
Subject:    Review Request: Fix KCmdLineArgs so that it doesn't strip the path
From:       "George Kiagiadakis" <kiagiadakis.george () gmail ! com>
Date:       2009-10-19 21:14:45
Message-ID: 20091019211445.26608.74278 () localhost
[Download RAW message or body]


-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
http://reviewboard.kde.org/r/1913/
-----------------------------------------------------------

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


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic