summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authortpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2010-04-05 17:55:01 +0000
committertpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2010-04-05 17:55:01 +0000
commitdbeab1b28062eafaa59edc13509ba3a348ed1853 (patch)
tree758da202ab7c5dbf7e3ca42224ce6d3945b17ddc
parentba57e8f5363965ebb0a63861914c0a2a97243274 (diff)
downloadtdelibs-dbeab1b28062eafaa59edc13509ba3a348ed1853.tar.gz
tdelibs-dbeab1b28062eafaa59edc13509ba3a348ed1853.zip
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
-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 )