Skip to content

Commit

Permalink
add minimum error handling for Windows related to the calling grass e…
Browse files Browse the repository at this point in the history
…nvironment
  • Loading branch information
gisma committed Jun 1, 2024
1 parent a2c6201 commit 040a5ce
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
4 changes: 3 additions & 1 deletion R/grassControl.R
Original file line number Diff line number Diff line change
Expand Up @@ -580,9 +580,11 @@ findGRASS <- function(searchLocation = "default",
quiet=TRUE) {

if (Sys.info()["sysname"] == "Windows") {
if (!grepl(x = system("o-help",intern =T),pattern = "OSGeo4W Shell Commands", fixed = TRUE)[1]){
check = try(system("o-help",intern = T),silent = T)
if(methods::is(check, "try-error")) {
message("PLEASE NOTE: if you use GRASS version > 7.8 and/or the OSGeo4W installation you must:\n 1) start the OSGeo4W shell\n 2) start grassxx --gtext\n 3) start Rstudio from command line in the shell\n Then both link2GI and rgrass should work.")
invisible(readkey())
stop()
}
if (searchLocation=="default") searchLocation <- "C:/"
else searchLocation = normalizePath(searchLocation)
Expand Down
6 changes: 3 additions & 3 deletions R/initProj.R
Original file line number Diff line number Diff line change
Expand Up @@ -51,12 +51,12 @@ setup_default = function(default=NULL, new_folder_list=NULL,new_folder_list_name
#'
#' @examples
#' \dontrun{
#' # createFolders(root_folder = "~/edu", folders = c("data/", "data/tmp/"))
#' createFolders(root_folder = tempdir(), folders = c("data/", "data/tmp/"))
#' }
#' # Create folder list and set variable names pointing to the path values
createFolders <- function(root_folder, folders,

create_folders = FALSE) {
create_folders = TRUE) {

folders <- lapply(folders, function(f) {
file.path(root_folder, f)
})
Expand Down

0 comments on commit 040a5ce

Please sign in to comment.