From a9005bef23e9970fd7d05d1b52566e6922e7199a Mon Sep 17 00:00:00 2001 From: Le Tan Date: Sun, 15 Aug 2021 09:44:30 +0800 Subject: [PATCH] PlantUml/Graphviz: support relative path --- src/widgets/editors/graphvizhelper.cpp | 3 ++- src/widgets/editors/plantumlhelper.cpp | 5 +++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/src/widgets/editors/graphvizhelper.cpp b/src/widgets/editors/graphvizhelper.cpp index 141687c9..e705ebc1 100644 --- a/src/widgets/editors/graphvizhelper.cpp +++ b/src/widgets/editors/graphvizhelper.cpp @@ -4,6 +4,7 @@ #include #include +#include using namespace vnotex; @@ -38,7 +39,7 @@ void GraphvizHelper::prepareProgramAndArgs(const QString &p_graphvizFile, p_program.clear(); p_args.clear(); - p_program = p_graphvizFile.isEmpty() ? QStringLiteral("dot") : QDir::toNativeSeparators(p_graphvizFile); + p_program = p_graphvizFile.isEmpty() ? QStringLiteral("dot") : QDir::toNativeSeparators(PathUtils::absolutePath(p_graphvizFile)); } QPair GraphvizHelper::testGraphviz(const QString &p_graphvizFile) diff --git a/src/widgets/editors/plantumlhelper.cpp b/src/widgets/editors/plantumlhelper.cpp index bd8d0474..74334333 100644 --- a/src/widgets/editors/plantumlhelper.cpp +++ b/src/widgets/editors/plantumlhelper.cpp @@ -4,6 +4,7 @@ #include #include +#include using namespace vnotex; @@ -61,12 +62,12 @@ void PlantUmlHelper::prepareProgramAndArgs(const QString &p_plantUmlJarFile, p_args << "-Djava.awt.headless=true"; #endif - p_args << "-jar" << QDir::toNativeSeparators(p_plantUmlJarFile); + p_args << "-jar" << QDir::toNativeSeparators(PathUtils::absolutePath(p_plantUmlJarFile)); p_args << "-charset" << "UTF-8"; if (!p_graphvizFile.isEmpty()) { - p_args << "-graphvizdot" << QDir::toNativeSeparators(p_graphvizFile); + p_args << "-graphvizdot" << QDir::toNativeSeparators(PathUtils::absolutePath(p_graphvizFile)); } p_args << "-pipe";