[education/rkward] rkward/windows: Fix check for pandoc

Thomas Friedrichsmeier null at kde.org
Mon Jun 24 22:13:02 BST 2024


Git commit ba869fd95e337054c158d5b1922f6bff4a433445 by Thomas Friedrichsmeier.
Committed on 21/06/2024 at 21:39.
Pushed by tfry into branch 'master'.

Fix check for pandoc

M  +9    -7    rkward/windows/rkcommandeditorwindow.cpp

https://invent.kde.org/education/rkward/-/commit/ba869fd95e337054c158d5b1922f6bff4a433445

diff --git a/rkward/windows/rkcommandeditorwindow.cpp b/rkward/windows/rkcommandeditorwindow.cpp
index 1564d59ab..b9194f483 100644
--- a/rkward/windows/rkcommandeditorwindow.cpp
+++ b/rkward/windows/rkcommandeditorwindow.cpp
@@ -412,16 +412,18 @@ QString withCheckForPandoc(const QString &command, const QString &error_file) {
 		"<a href=\"rkward://settings/rbackend\">Settings->Configure RKward->R-backend</a>."));
 	QString ret(
 		"if (!nzchar(Sys.which(\"pandoc\"))) {\n"
-		"	output <- rk.set.output.html.file(%1, silent=TRUE)\n"
-		"	rk.header(%3)\n"
-		"	rk.print(%4)\n"
-		"	rk.set.output.html.file(output, silent=TRUE)\n"
-		"	rk.show.html(%1)\n"
+		"	if(!file.exists(%1)) {\n"
+		"		output <- rk.set.output.html.file(%1, silent=TRUE)\n"
+		"		rk.header(%3)\n"
+		"		rk.print(%4)\n"
+		"		rk.set.output.html.file(output, silent=TRUE)\n"
+		"		rk.show.html(%1)\n"
+		"	}\n"
 		"} else {\n"
-		"%2\n"
+		"%2"
 		"}\n"
 	);
-	return ret.arg(error_file, command, header, message);
+	return ret.arg(RObject::rQuote(error_file), command, header, message);
 }
 
 void RKCommandEditorWindow::initPreviewModes() {



More information about the rkward-tracker mailing list