From dbeab1b28062eafaa59edc13509ba3a348ed1853 Mon Sep 17 00:00:00 2001 From: tpearson Date: Mon, 5 Apr 2010 17:55:01 +0000 Subject: Set the working directory to the same directory as the executable when running an executable directly in konqueror Fixes Bug 168 git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/kdelibs@1111449 283d02a7-25f6-0310-bc7c-ecb5cbfe19da --- kio/kio/krun.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/kio/kio/krun.cpp b/kio/kio/krun.cpp index 6acfb3b74..8384e2c3d 100644 --- a/kio/kio/krun.cpp +++ b/kio/kio/krun.cpp @@ -853,8 +853,11 @@ pid_t KRun::runCommand( const QString& cmd, const QString &execName, const QStri proc->setUseShell(true); *proc << cmd; KService::Ptr service = KService::serviceByDesktopName( binaryName( execName, true ) ); - return runCommandInternal( proc, service.data(), binaryName( execName, false ), execName, iconName, - window, asn ); + QStringList args = KShell::splitArgs( cmd ); + for (QStringList::ConstIterator it = args.begin(); it != args.end(); ++it) + if (!(*it).contains('=')) + proc->setWorkingDirectory((*it).mid(0, (*it).findRev('/'))); + return runCommandInternal( proc, service.data(), binaryName( execName, false ), execName, iconName, window, asn ); } KRun::KRun( const KURL& url, mode_t mode, bool isLocalFile, bool showProgressInfo ) -- cgit v1.2.1