Skip to content
Snippets Groups Projects
Unverified Commit cf09c649 authored by David Klein's avatar David Klein Committed by GitHub
Browse files

Merge pull request #107 from johanneskoch94/Rprofile_change

Add library choice explanations to .Rprofile
parents 8249df26 c7ee2131
No related branches found
No related tags found
No related merge requests found
......@@ -4,12 +4,19 @@ if(file.exists("~/.Rprofile")) source("~/.Rprofile")
# Check if the library folder is currently being updated and if so use lattest snapshot.
if (any(grepl("^00LOCK.*", system(paste0("ls ", .libPaths()[1]), intern = TRUE)))) {
cat("\nPackages in the default R library are currently being updated. Packages will be loaded from the library's lattest snapshot instead.\n")
lock_folders <- grep("^00LOCK.*", system(paste0("ls ", .libPaths()[1]), intern = TRUE), value=TRUE)
bad_pacakges <- gsub("^00LOCK-","", lock_folders)
snapshot_folder <- "/p/projects/rd3mod/R/libraries/snapshots/"
snapshot_dates <- system(paste0("ls ", snapshot_folder), intern = TRUE)
lattest_snapshot <- paste0(snapshot_folder, snapshot_dates[length(snapshot_dates)])
# Give user diagnosis
cat("\nThe following lock folders were found at", .libPaths()[1],":\n\t", lock_folders,"\n")
cat("That means that the ",bad_pacakges,"package(s) is(are) currently being updated.\n")
cat("Packages will be loaded from the library's lattest snapshot instead:\n",lattest_snapshot,"\n")
cat("(If the lock folder isn't deleted automatically in the next couple of minutes, that means the package failed to update/install and that the folder has to be removed manually!)\n")
if(file.exists(lattest_snapshot)) {
.libPaths(lattest_snapshot)
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment