[education/rkward] /: Try to create R_LIBS_USER, if it does not exist.

Thomas Friedrichsmeier null at kde.org
Wed Jun 30 15:29:25 BST 2021


Git commit 6a1f802086c7eb4ddc4ca742deb075105fb62715 by Thomas Friedrichsmeier.
Committed on 30/06/2021 at 14:28.
Pushed by tfry into branch 'master'.

Try to create R_LIBS_USER, if it does not exist.

M  +1    -0    ChangeLog
M  +1    -0    rkward/rbackend/rkrinterface.cpp
M  +1    -1    rkward/rbackend/rkwarddevice/rkgraphicsdevice.cpp
M  +1    -1    rkward/rbackend/rkwarddevice/rkgraphicsdevice.h
M  +2    -2    rkward/rbackend/rkwarddevice/rkgraphicsdevice_setup.cpp
M  +1    -1    rkward/rbackend/rkwarddevice/rkgraphicsdevice_stubs.cpp

https://invent.kde.org/education/rkward/commit/6a1f802086c7eb4ddc4ca742deb075105fb62715

diff --git a/ChangeLog b/ChangeLog
index 99a22016..399c0a51 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,4 @@
+- (Try to) automatically create R user library location, if it does not exist
 - Workaround for invalid EDITOR variable set by Kate Terminal plugin (also fixed in recent kate)
 - kate plugin related actions are now active whenever a script window is active (not only the corresponding tool window)
   - TODO: support kate plugins in detached windows
diff --git a/rkward/rbackend/rkrinterface.cpp b/rkward/rbackend/rkrinterface.cpp
index 1ba560f8..1e9af664 100644
--- a/rkward/rbackend/rkrinterface.cpp
+++ b/rkward/rbackend/rkrinterface.cpp
@@ -413,6 +413,7 @@ void RInterface::handleRequest (RBackendRequest* request) {
 		RCommandChain *chain = openSubcommandChain (runningCommand ());
 
 		issueCommand ("paste (R.version[c (\"major\", \"minor\")], collapse=\".\")\n", RCommand::GetStringVector | RCommand::App | RCommand::Sync, QString (), this, GET_R_VERSION, chain);
+		issueCommand ("try({userdir<-path.expand(Sys.getenv(\"R_LIBS_USER\")); if(length(userdir)==1L && !file.exists(userdir)) dir.create(userdir) })\n", RCommand::App | RCommand::Sync, QString (), this, 0, chain);
 		// find out about standard library locations
 		issueCommand ("c(path.expand(Sys.getenv(\"R_LIBS_USER\")), .libPaths())\n", RCommand::GetStringVector | RCommand::App | RCommand::Sync, QString (), this, GET_LIB_PATHS, chain);
 		// start help server / determined help base url
diff --git a/rkward/rbackend/rkwarddevice/rkgraphicsdevice.cpp b/rkward/rbackend/rkwarddevice/rkgraphicsdevice.cpp
index 88690f58..487bcf3b 100644
--- a/rkward/rbackend/rkwarddevice/rkgraphicsdevice.cpp
+++ b/rkward/rbackend/rkwarddevice/rkgraphicsdevice.cpp
@@ -2,7 +2,7 @@
                           rkgraphicsdevice_backendtransmitter  -  description
                              -------------------
     begin                : Mon Mar 18 20:06:08 CET 2013
-    copyright            : (C) 2013, 2014 by Thomas Friedrichsmeier 
+    copyright            : (C) 2013-2021 by Thomas Friedrichsmeier
     email                : thomas.friedrichsmeier at kdemail.net
  ***************************************************************************/
 
diff --git a/rkward/rbackend/rkwarddevice/rkgraphicsdevice.h b/rkward/rbackend/rkwarddevice/rkgraphicsdevice.h
index 88805716..7d643fa2 100644
--- a/rkward/rbackend/rkwarddevice/rkgraphicsdevice.h
+++ b/rkward/rbackend/rkwarddevice/rkgraphicsdevice.h
@@ -2,7 +2,7 @@
                           rkgraphicsdevice_backendtransmitter  -  description
                              -------------------
     begin                : Mon Mar 18 20:06:08 CET 2013
-    copyright            : (C) 2013-2014 by Thomas Friedrichsmeier 
+    copyright            : (C) 2013-2014 by Thomas Friedrichsmeier
     email                : thomas.friedrichsmeier at kdemail.net
  ***************************************************************************/
 
diff --git a/rkward/rbackend/rkwarddevice/rkgraphicsdevice_setup.cpp b/rkward/rbackend/rkwarddevice/rkgraphicsdevice_setup.cpp
index e215c090..e0a57b18 100644
--- a/rkward/rbackend/rkwarddevice/rkgraphicsdevice_setup.cpp
+++ b/rkward/rbackend/rkwarddevice/rkgraphicsdevice_setup.cpp
@@ -2,7 +2,7 @@
                           rkgraphicsdevice_setup  -  description
                              -------------------
     begin                : Mon Mar 18 20:06:08 CET 2013
-    copyright            : (C) 2013-2014 by Thomas Friedrichsmeier 
+    copyright            : (C) 2013-2021 by Thomas Friedrichsmeier
     email                : thomas.friedrichsmeier at kdemail.net
  ***************************************************************************/
 
@@ -227,7 +227,7 @@ bool RKGraphicsDeviceDesc::init (pDevDesc dev, double pointsize, const QStringLi
 	dev->releaseClipPath = RKD_ReleaseClipPath;
 	dev->setMask = RKD_SetMask;
 	dev->releaseMask = RKD_ReleaseMask;
-	dev->deviceVersion = 14;
+	dev->deviceVersion = qMin(14, R_GE_version);
 	dev->deviceClip = FALSE; // for now
 #endif
 	return true;
diff --git a/rkward/rbackend/rkwarddevice/rkgraphicsdevice_stubs.cpp b/rkward/rbackend/rkwarddevice/rkgraphicsdevice_stubs.cpp
index a5b9b8ed..addabba2 100644
--- a/rkward/rbackend/rkwarddevice/rkgraphicsdevice_stubs.cpp
+++ b/rkward/rbackend/rkwarddevice/rkgraphicsdevice_stubs.cpp
@@ -2,7 +2,7 @@
                           rkgraphicsdevice_stubs  -  description
                              -------------------
     begin                : Mon Mar 18 20:06:08 CET 2013
-    copyright            : (C) 2013-2014 by Thomas Friedrichsmeier 
+    copyright            : (C) 2013-2021 by Thomas Friedrichsmeier
     email                : thomas.friedrichsmeier at kdemail.net
  ***************************************************************************/
 


More information about the rkward-tracker mailing list