[education/rkward] rkward/windows: Clean up rmarkdown preview cache files

Thomas Friedrichsmeier null at kde.org
Wed Jul 31 13:22:03 BST 2024


Git commit 81635f3049266eff7e076638dcdd12d6bee547d8 by Thomas Friedrichsmeier.
Committed on 31/07/2024 at 12:21.
Pushed by tfry into branch 'master'.

Clean up rmarkdown preview cache files

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

https://invent.kde.org/education/rkward/-/commit/81635f3049266eff7e076638dcdd12d6bee547d8

diff --git a/rkward/windows/rkcommandeditorwindow.cpp b/rkward/windows/rkcommandeditorwindow.cpp
index cf9cf4c3c..e451eec18 100644
--- a/rkward/windows/rkcommandeditorwindow.cpp
+++ b/rkward/windows/rkcommandeditorwindow.cpp
@@ -562,6 +562,13 @@ class RKScriptPreviewIO {
 	}
 public:
 	~RKScriptPreviewIO() {
+		{
+			// rkmarkdown::render() leaves these directories lying around, even if clean=TRUE. interemdiates_dir does not seem to have an effect. (07/2024)
+			// the name should be unique enough, though, so let's clean them
+			auto fi = QFileInfo(*infile);
+			auto known_temp_path = fi.absolutePath() + '/' + fi.baseName() + QLatin1String("_cache");
+			QDir(known_temp_path).removeRecursively();
+		}
 		infile->remove();
 		delete infile;
 	}


More information about the rkward-tracker mailing list