diff --git a/R/zzz.R b/R/zzz.R index 7feaeb78508487116ff28f1efb77e52b775a2c94..f1f1255fa43d65a4b9bf5e47eed387c42c01120d 100644 --- a/R/zzz.R +++ b/R/zzz.R @@ -9,49 +9,27 @@ vtk <- NULL op <- options() op.r2ogs6 <- list( # Default paths - r2ogs6.default_sim_path = "", - r2ogs6.default_script_path = "", - r2ogs6.default_benchmark_path = "", - r2ogs6.default_ogs6_processlib_path = "", - r2ogs6.default_ogs6_bin_path = "", - r2ogs6.max_lines_gml = 300, - - # External file reference tags - - # Reticulate setting for reading in VTK - r2ogs6.use_python = "" + r2ogs6.default_sim_path = NULL, + r2ogs6.default_script_path = NULL, + r2ogs6.default_benchmark_path = NULL, + r2ogs6.default_ogs6_processlib_path = NULL, + r2ogs6.default_ogs6_bin_path = NULL, + r2ogs6.max_lines_gml = NULL ) toset <- !(names(op.r2ogs6) %in% names(op)) if (any(toset)) options(op.r2ogs6[toset]) - # use superassignments to update global Python references - vtk <<- reticulate::import("vtk", delay_load = TRUE) - - test_config <- TRUE + cfg <- config::get() - if (test_config) { - options( - r2ogs6.default_sim_path = "D:/OGS_sims/", - r2ogs6.default_script_path = "D:/OGS_scripts/", - r2ogs6.default_benchmark_path = - "D:/Programme/OpenGeoSys/ogs-master/Tests/Data/", - r2ogs6.default_ogs6_processlib_path = - "D:/Programme/OpenGeoSys/ogs-master/ProcessLib/", - r2ogs6.default_ogs6_bin_path = - paste0( - "D:/Programme/OpenGeoSys/", - "ogs-6.3.3-Windows-10.0.14393-python-3.7.2-de-utils", - "/bin/" - ), - r2ogs6.max_lines_gml = 300, - r2ogs6.use_python = "D:/Programme/anaconda3/envs/rtest/python.exe" - ) - - reticulate::use_virtualenv(unlist(options("r2ogs6.use_python"))) + for(i in names(op.r2ogs6)){ + eval(parse(text = paste0("options(", i, " = cfg$", i, ")"))) } - invisible() + # use superassignments to update global Python references + vtk <<- reticulate::import("vtk", delay_load = TRUE) + + return(invisible()) }