Commit c3839ccf authored by Dominik Haumann's avatar Dominik Haumann Committed by Christoph Cullmann
Browse files

External tools: Correctly set the working directory

The old implementation does not seem to work under Windows.

CCBUG: 416320
parent 0242ca2d
......@@ -25,6 +25,7 @@
#include <KLocalizedString>
#include <KShell>
#include <KTextEditor/View>
#include <QFileInfo>
KateToolRunner::KateToolRunner(std::unique_ptr<KateExternalTool> tool, KTextEditor::View *view, QObject *parent)
: QObject(parent)
......@@ -56,9 +57,9 @@ void KateToolRunner::run()
} else if (m_view) {
// if nothing is set, use the current document's directory
const auto url = m_view->document()->url();
if (url.isValid()) {
const QString path = m_view->document()->url().toString(QUrl::RemoveScheme | QUrl::RemoveFilename);
m_process->setWorkingDirectory(path);
if (url.isLocalFile()) {
const QString localFilePath = url.toLocalFile();
m_process->setWorkingDirectory(QFileInfo(localFilePath).absolutePath());
}
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment