From 13da15f83844afa55de41ab2940541f5ae586187 Mon Sep 17 00:00:00 2001 From: tpearson Date: Wed, 14 Apr 2010 01:24:04 +0000 Subject: Set working path properly when running executable in Konqueror git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/kdelibs@1114572 283d02a7-25f6-0310-bc7c-ecb5cbfe19da --- kio/kio/krun.cpp | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/kio/kio/krun.cpp b/kio/kio/krun.cpp index 8384e2c3d..8da71c8a0 100644 --- a/kio/kio/krun.cpp +++ b/kio/kio/krun.cpp @@ -853,10 +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 ) ); - 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('/'))); + QString bin = binaryName( cmd, false ); + int pos = bin.findRev( '/' ); + if (pos != -1) { + proc->setWorkingDirectory( bin.mid(0, pos) ); + } return runCommandInternal( proc, service.data(), binaryName( execName, false ), execName, iconName, window, asn ); } -- cgit v1.2.1