From feadc1fb6d349fe497092e2e75b8b1fab2a52e69 Mon Sep 17 00:00:00 2001
From: "B.Anderson" <ba1e12@srv02405.soton.ac.uk>
Date: Mon, 18 May 2020 12:32:47 +0100
Subject: [PATCH] added code to set J: drive SERG 'public' data mount point as
 dPath and (optionally) list the files

---
 env.R | 14 ++++++++++++++
 1 file changed, 14 insertions(+)

diff --git a/env.R b/env.R
index 180039a..191a5ae 100644
--- a/env.R
+++ b/env.R
@@ -2,6 +2,7 @@
 # here's why a project level .Rprofile should not be used for this job https://support.rstudio.com/hc/en-us/articles/360047157094-Managing-R-with-Rprofile-Renviron-Rprofile-site-Renviron-site-rsession-conf-and-repos-conf
 
 repoParams <- list() # params holder as a list. Sooooo much easier with tab complete
+listFiles <- TRUE
 
 # Location ----
 # attempt to guess the platform & user
@@ -11,5 +12,18 @@ repoParams$nodename <- repoParams$info[[4]]
 repoParams$login <- repoParams$info[[6]]
 repoParams$user <- repoParams$info[[7]]
 
+# use this guess to set a data path
+# default
+dPath <- "unkown - fix your code!"
+if (repoParams$nodename == "srv02405") {
+  # we're on the UoS RStudio server so we can set the data path to J: (as mounted)
+  dPath <- path.expand("/mnt/SERG_data/")
+}
+
 message("You're ", repoParams$user, " using " , repoParams$sysname, " on ", repoParams$nodename)
+message("Default dPath has been set to: ", dPath)
+if (listFiles) { # optional
+  message("and these are the files/folders in that dPath")
+  try(list.files(dPath)) # in case it breaks
+}
 message("Hopefully that's what you expected...")
\ No newline at end of file
-- 
GitLab