summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--kio/kio/krun.cpp7
1 files 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 )