[rkward] rkward/rbackend: Properly unload package in case of version mismatch

Thomas Friedrichsmeier null at kde.org
Sat Jan 18 09:48:35 GMT 2020


Git commit 0ef50185536f873a751b2317865fc392f9eaa3ce by Thomas Friedrichsmeier.
Committed on 18/01/2020 at 09:46.
Pushed by tfry into branch 'master'.

Properly unload package in case of version mismatch

M  +6    -6    rkward/rbackend/rkrbackend.cpp

https://commits.kde.org/rkward/0ef50185536f873a751b2317865fc392f9eaa3ce

diff --git a/rkward/rbackend/rkrbackend.cpp b/rkward/rbackend/rkrbackend.cpp
index b1c8b5d1..208b1c39 100644
--- a/rkward/rbackend/rkrbackend.cpp
+++ b/rkward/rbackend/rkrbackend.cpp
@@ -1655,12 +1655,12 @@ void RKRBackend::initialize (const char *locale_dir) {
 	                  "  if (!dir.exists (libloc)) dir.create(libloc, recursive=TRUE)\n"
 	                  "  ok <- FALSE\n"
 	                  "  suppressWarnings (try ({library (\"rkward\", lib.loc=libloc); " + versioncheck + "; ok <- TRUE}))\n"
-					  "  if (!ok) {\n"
-					  "    suppressWarnings (try (detach(\"package:rkward\")))\n"
-					  "    install.packages(normalizePath(paste(libloc, \"..\", c (\"rkward.tgz\", \"rkwardtests.tgz\"), sep=\"/\")), lib=libloc, repos=NULL, type=\"source\")\n"
-					  "    library (\"rkward\",  lib.loc=libloc)\n"
-					  "  }\n"
-					  "})\n";
+	                  "  if (!ok) {\n"
+	                  "    suppressWarnings (try (detach(\"package:rkward\", unload=TRUE)))\n"
+	                  "    install.packages(normalizePath(paste(libloc, \"..\", c (\"rkward.tgz\", \"rkwardtests.tgz\"), sep=\"/\")), lib=libloc, repos=NULL, type=\"source\")\n"
+	                  "    library (\"rkward\", lib.loc=libloc)\n"
+	                  "  }\n"
+	                  "})\n";
 	if (!runDirectCommand (command)) lib_load_fail = true;
 	RK_setupGettext (locale_dir);	// must happen *after* package loading, since R will re-set it
 	if (!runDirectCommand (versioncheck)) lib_load_fail = true;



More information about the rkward-tracker mailing list