Skip to content

Commit

Permalink
homegenize C:/ /usr/bin
Browse files Browse the repository at this point in the history
  • Loading branch information
gisma committed Apr 24, 2024
1 parent 20fc01b commit 07f2c50
Show file tree
Hide file tree
Showing 76 changed files with 246 additions and 249 deletions.
2 changes: 1 addition & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ Imports:
xml2,
xfun
SystemRequirements: GNU make
RoxygenNote: 7.2.3
RoxygenNote: 7.3.1
Suggests: knitr,
rmarkdown,
sp,
Expand Down
18 changes: 9 additions & 9 deletions R/gdalControls.R
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ setenvGDAL <- function(bin_GDAL = NULL){
#'@title Search recursively for valid 'GDAL' installation(s) on a 'Windows' OS
#'@name searchGDALW
#'@description Search for valid 'GDAL' installations on a 'Windows' OS
#'@param DL drive letter default is "C:"
#'@param DL drive letter default is "C:/"
#'@param quiet boolean switch for supressing console messages default is TRUE
#'@return A dataframe with the 'GDAL' root folder(s) the version name(s) and the installation type(s).
#'@author Chris Reudenbach
Expand Down Expand Up @@ -202,10 +202,10 @@ searchGDALW <- function(DL = "C:/",
return(gdal1)
}

#'@title Search recursively for valid 'GDAL' installation(s) on a 'Windows' OS
#'@title Search recursively for valid 'GDAL' installation(s) on a 'X-based' OS
#'@name searchGDALX
#'@description Search for valid 'GDAL' installations on a 'Windows' OS
#'@param MP drive letter default is "C:"
#'@description Search for valid 'GDAL' installations on a 'X-based' OS
#'@param MP drive letter default is "/usr/bin"
#'@param quiet boolean switch for supressing messages default is TRUE
#'@return A dataframe with the 'GDAL' root folder(s) the version name(s) and the installation type(s).
#'@author Chris Reudenbach
Expand All @@ -220,9 +220,9 @@ searchGDALW <- function(DL = "C:/",
#' searchGDALX()
#' }

searchGDALX <- function(MP = "/usr",
searchGDALX <- function(MP = "/usr/bin",
quiet=TRUE) {
if (MP=="default") MP <- "/usr"
if (MP=="default") MP <- "/usr/bin"
if (!exists("GiEnv")) GiEnv <- new.env(parent=globalenv())
# trys to find a osgeo4w installation at the mounting point disk returns root directory and version name
# recursive dir for gdal*.bat returns all version of gdal bat files
Expand Down Expand Up @@ -278,7 +278,7 @@ searchGDALX <- function(MP = "/usr",
#'stand_alone installations. The functions trys to find all valid
#'installations by analysing the calling batch scripts.
#'@param searchLocation drive letter to be searched, for Windows systems default
#' is \code{C:}, for Linux systems default is \code{/usr}.
#' is \code{C:/}, for Linux systems default is \code{/usr/bin}.
#'@param quiet boolean switch for supressing console messages default is TRUE
#'@return A dataframe with the 'GDAL' root folder(s), and command line executable(s)
#'@author Chris Reudenbach
Expand All @@ -296,13 +296,13 @@ findGDAL <- function(searchLocation = "default",
quiet=TRUE) {

if (Sys.info()["sysname"] == "Windows") {
if (searchLocation=="default") searchLocation <- "C:"
if (searchLocation=="default") searchLocation <- "C:/"
if (grepl(paste0(LETTERS, ":", collapse="|"), searchLocation))
link = link2GI::searchGDALW(DL = searchLocation,
quiet=TRUE)
else stop("You are running Windows - Please choose a suitable searchLocation argument that MUST include a Windows drive letter and colon" )
} else {
if (searchLocation=="default") searchLocation <- "/usr"
if (searchLocation=="default") searchLocation <- "/usr/bin"
if (grepl(searchLocation,pattern = ":")) stop("You are running Linux - please choose a suitable searchLocation argument" )
else link = link2GI::searchGDALX(MP = searchLocation,
quiet=TRUE)
Expand Down
16 changes: 8 additions & 8 deletions R/grassControl.R
Original file line number Diff line number Diff line change
Expand Up @@ -118,15 +118,15 @@ paramGRASSx <- function(set_default_GRASS=NULL,
#' }

paramGRASSw <- function(set_default_GRASS=NULL,
DL="C:",
DL="C:/",
ver_select =FALSE,
quiet = TRUE) {
if (ver_select =='T') ver_select <- TRUE
if (ver_select == "F" && !is.numeric(ver_select)) ver_select <- FALSE
if (Sys.info()["sysname"]=="Linux") return(cat("You are running Linux - please choose a suitable searchLocation argument"))
# (R) set pathes of 'GRASS' binaries depending on 'WINDOWS'
if (is.null(set_default_GRASS)) {
if (DL=="default" || is.null(DL)) DL <- "C:"
if (DL=="default" || is.null(DL)) DL <- "C:/"
# if no path is provided we have to search
params_GRASS <- findGRASS(searchLocation = DL,
quiet = quiet)
Expand Down Expand Up @@ -218,22 +218,22 @@ paramGRASSw <- function(set_default_GRASS=NULL,
#'@name searchGRASSW
#'@title Search for valid OSGeo4W 'GRASS GIS' installation(s) on a given 'Windows' drive
#'@description Provides an list of valid 'GRASS GIS' installation(s) on your 'Windows' system. There is a major difference between osgeo4W and stand_alone installations. The functions trys to find all valid installations by analysing the calling batch scripts.
#'@param DL drive letter to be searched, default is "C:"
#'@param DL drive letter to be searched, default is \code{C:/}
#'@param quiet boolean switch for supressing console messages default is TRUEs
#'@return A dataframe with the 'GRASS GIS' root folder(s), version name(s) and installation type code(s)
#'@author Chris Reudenbach
#'@export searchGRASSW
#'@keywords internal
#'@examples
#' \dontrun{
#' # get all valid 'GRASS GIS' installation folders and params at "C:"
#' # get all valid 'GRASS GIS' installation folders and params at "C:/"
#' searchGRASSW()
#' }

searchGRASSW <- function(DL = "C:",
searchGRASSW <- function(DL = "C:/",
quiet =TRUE){

if (DL=="default") DL <- "C:"
if (DL=="default") DL <- "C:/"

# trys to find a osgeo4w installation on the whole C: disk returns root directory and version name
# recursive dir for grass*.bat returns all version of grass bat files
Expand Down Expand Up @@ -556,7 +556,7 @@ checkGisdbase <- function(x = NULL , gisdbase = NULL, location = NULL, gisdbase_
#'For Windows systems
#'it is mandatory to include an uppercase Windows drive letter and a colon.
#' Default For Windows Systems
#' is \code{C:}, for Linux systems default is \code{/usr/bin}.
#' is \code{C:/}, for Linux systems default is \code{/usr/bin}.
#'@param ver_select boolean default is FALSE. If there is more than one 'SAGA GIS' installation and \code{ver_select} = TRUE the user can select interactively the preferred 'SAGA GIS' version
#'@param quiet boolean switch for supressing console messages default is TRUE
#'@return A dataframe with the 'GRASS GIS' binary folder(s) (i.e. where the
Expand All @@ -576,7 +576,7 @@ findGRASS <- function(searchLocation = "default",
quiet=TRUE) {

if (Sys.info()["sysname"] == "Windows") {
if (searchLocation=="default") searchLocation <- "C:"
if (searchLocation=="default") searchLocation <- "C:/"
if (grepl(paste0(LETTERS, ":", collapse="|"), searchLocation) )
link = link2GI::searchGRASSW(DL = searchLocation)
else return(cat("You are running Windows - Please choose a suitable searchLocation argument that MUST include a Windows drive letter and colon"))
Expand Down
8 changes: 4 additions & 4 deletions R/linkGDAL.R
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ if (!isGeneric('linkGDAL')) {
#'@details It looks for the \code{gdalinfo(.exe)} file. If the file is found in a \code{bin} folder it is assumed to be a valid 'GDAL' binary installation.
#'@param bin_GDAL string contains path to where the gdal binaries are located
#'@param ver_select Boolean default is FALSE. If there is more than one 'GDAL' installation and \code{ver_select} = TRUE the user can select interactively the preferred 'GDAL' version
#'@param searchLocation string hard drive letter default is \code{C:}
#'@param searchLocation string hard drive letter default is \code{C:/}
#'@param quiet Boolean switch for suppressing messages default is TRUE
#'@param returnPaths Boolean if set to FALSE the pathes of the selected version are written
#' to the PATH variable only, otherwise all paths and versions of the installed GRASS versions ae returned.
Expand Down Expand Up @@ -39,14 +39,14 @@ linkGDAL <- function(bin_GDAL=NULL,
gdal<-list()
if (is.null(searchLocation)){
if (Sys.info()["sysname"] == "Windows") {
searchLocation<-"C:"
searchLocation<-"C:/"
} else
{searchLocation<-"/usr"}
}
params_GDAL <- findGDAL(searchLocation = searchLocation,quiet = quiet)
# if no path is provided we have to search
#cat(nrow(params_GDAL))
#params_GDAL <- system2("find", paste("/usr"," ! -readable -prune -o -type f -executable -iname 'gdalinfo' -print"),stdout = TRUE)
#params_GDAL <- system2("find", paste("/usr/bin"," ! -readable -prune -o -type f -executable -iname 'gdalinfo' -print"),stdout = TRUE)
#bin_GDAL <- substr(params_GDAL,1,nchar(params_GDAL) - 6)
#pathGDAL <- bin_GDAL
#params_GDAL <- searchGDALW()
Expand Down Expand Up @@ -103,7 +103,7 @@ linkGDAL <- function(bin_GDAL=NULL,
# }

# else {
# # if (is.null(searchLocation)) searchLocation<-"C:"
# # if (is.null(searchLocation)) searchLocation<-"C:/"
# # params_GDAL <- findGDAL(searchLocation = searchLocation,quiet = quiet)
# #if ( params_GDAL != FALSE)
# if (nrow(params_GDAL$gdalInstallations) == 1) {
Expand Down
2 changes: 1 addition & 1 deletion R/linkGRASS.R
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ linkGRASS = function(x = NULL,
# search for GRASS on your system
if (Sys.info()["sysname"] == "Windows") {
if (use_home) home = Sys.getenv("USERPROFILE")
if (is.null(search_path)) search_path = "C:"
if (is.null(search_path)) search_path = "C:/"
grass = paramGRASSw(default_GRASS,search_path,ver_select)
} else {
if (use_home) home = Sys.getenv("HOME")
Expand Down
2 changes: 1 addition & 1 deletion R/linkOTB.R
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ linkOTB <- function(bin_OTB=NULL,

if (is.null(searchLocation)){
if (Sys.info()["sysname"] == "Windows") {
searchLocation<-"C:"
searchLocation<-"C:/"
} else
{searchLocation<-"/usr/bin/"}
}
Expand Down
2 changes: 1 addition & 1 deletion R/linkSAGA.R
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ if ( !isGeneric("linkSAGA") ) {
#'@return A list containing the selected \code{RSAGA} path variables \code{$sagaPath},\code{$sagaModPath},\code{$sagaCmd} and potentially other installations \code{$installed}
#'@param default_SAGA string contains path to \code{RSAGA} binaries
#'@param searchLocation drive letter to be searched, for Windows systems default
#' is \code{C:}, for Linux systems default is \code{/usr}.
#' is \code{C:}, for Linux systems default is \code{/usr/bin}.
#'@param ver_select boolean default is FALSE. If there is more than one 'SAGA GIS' installation and \code{ver_select} = TRUE the user can select interactively the preferred 'SAGA GIS' version
#'@param quiet boolean switch for supressing console messages default is TRUE
#'@param returnPaths boolean if set to FALSE the pathes of the selected version are written
Expand Down
9 changes: 4 additions & 5 deletions R/otbControls.R
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ setenvOTB <- function(bin_OTB = NULL, root_OTB = NULL){
#'@title Search recursively for valid 'OTB' installation(s) on a 'Windows' OS
#'@name searchOTBW
#'@description Search for valid 'OTB' installations on a 'Windows' OS
#'@param DL drive letter default is "C:"
#'@param DL drive letter default is \code{C:/}
#'@param quiet boolean switch for supressing console messages default is TRUE
#'@return A dataframe with the 'OTB' root folder(s) the version name(s) and the installation type(s).
#'@author Chris Reudenbach
Expand All @@ -52,7 +52,7 @@ setenvOTB <- function(bin_OTB = NULL, root_OTB = NULL){

searchOTBW <- function(DL = "default",
quiet=TRUE) {
if (DL=="default") DL <- "C:"
if (DL=="default") DL <- "C:/"
if (Sys.info()["sysname"] == "Windows") {
if (!exists("GiEnv")) GiEnv <- new.env(parent=globalenv())

Expand Down Expand Up @@ -196,8 +196,7 @@ searchOTBX <- function(MP = "default",
#'on your 'Windows' system. There is a major difference between osgeo4W and
#'stand_alone installations. The functions trys to find all valid
#'installations by analysing the calling batch scripts.
#'@param searchLocation drive letter to be searched, for Windows systems default
#' is \code{C:}, for Linux systems default is \code{/usr}.
#'@param searchLocation drive letter to be searched, for Windows systems default is \code{C:/}, for Linux systems default is \code{/usr/bin}.
#'@param quiet boolean switch for supressing console messages default is TRUE
#'@return A dataframe with the 'OTB' root folder(s), and command line executable(s)
#'@author Chris Reudenbach
Expand All @@ -213,7 +212,7 @@ findOTB <- function(searchLocation = "default",
quiet=TRUE) {

if (Sys.info()["sysname"] == "Windows") {
if (searchLocation=="default") searchLocation <- "C:"
if (searchLocation=="default") searchLocation <- "C:/"
if (grepl(paste0(LETTERS, ":", collapse="|"), searchLocation))
link = link2GI::searchOTBW(DL = searchLocation,
quiet=TRUE)
Expand Down
18 changes: 9 additions & 9 deletions R/sagaControl.R
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
#'@title Searches recursively for existing 'Windows' 'SAGA GIS' installation(s)
#'@name searchSAGAX
#'@description Search for valid 'GRASS GIS' installations at a given 'Linux' mount point
#'@param MP default mount point is \code{/usr}
#'@param MP default mount point is \code{/usr/bin}
#'@param quiet Boolean switch for suppressing console messages default is TRUE
#'@return A data frame containing the 'SAGA GIS' root folder(s), the version name(s) and the installation type(s)
#'@author Chris Reudenbach
Expand All @@ -17,9 +17,9 @@
#' searchSAGAX()
#' }

searchSAGAX <- function(MP = "/usr",
searchSAGAX <- function(MP = "/usr/bin",
quiet = TRUE) {
if (MP=="default") MP <- "/usr"
if (MP=="default") MP <- "/usr/bin"

if (Sys.info()["sysname"] == "Linux") {

Expand Down Expand Up @@ -70,7 +70,7 @@ searchSAGAX <- function(MP = "/usr",
#'@title Searches recursively for existing 'Windows' 'SAGA GIS' installation(s)
#'@name searchSAGAW
#'@description Searches recursivley for existing 'SAGA GIS' installation(s) on a given 'Windows' drive
#'@param DL drive letter default is "C:"
#'@param DL drive letter default is \code{C:/}
#'@param quiet boolean switch for supressing messages default is TRUE
#'@return A dataframe contasining the 'SAGA GIS' root folder(s), the version name(s) and the installation type(s)
#'@author Chris Reudenbach
Expand All @@ -86,9 +86,9 @@ searchSAGAX <- function(MP = "/usr",
#' }


searchSAGAW <- function(DL = "C:",
searchSAGAW <- function(DL = "C:/",
quiet = TRUE) {
if (DL=="default") DL <- "C:"
if (DL=="default") DL <- "C:/"
if (Sys.info()["sysname"] == "Windows") {
sagaPath <- NULL #checkPCDomain("saga")
if (is.null(sagaPath)) {
Expand Down Expand Up @@ -204,7 +204,7 @@ searchSAGAX <- function(MP = "/usr",
#'stand_alone installations. The functions trys to find all valid
#'installations by analysing the calling batch scripts.
#'@param searchLocation drive letter to be searched, for Windows systems default
#' is \code{C:}, for Linux systems default is \code{/usr}.
#' is \code{C:/}, for Linux systems default is \code{/usr/bin}.
#'@param quiet boolean switch for supressing console messages default is TRUE

#'@return A dataframe with the 'SAGA GIS' root folder(s), version name(s) and
Expand All @@ -222,12 +222,12 @@ findSAGA <- function(searchLocation = "default",
quiet = TRUE) {

if (Sys.info()["sysname"] == "Windows") {
if (searchLocation=="default") searchLocation <- "C:"
if (searchLocation=="default") searchLocation <- "C:/"
if (grepl(paste0(LETTERS, ":", collapse="|"), searchLocation))
link = link2GI::searchSAGAW(DL = searchLocation,quiet = quiet)
else stop("You are running Windows - Please choose a suitable searchLocation argument that MUST include a Windows drive letter and colon" )
} else {
if (searchLocation=="default") searchLocation <- "/usr"
if (searchLocation=="default") searchLocation <- "/usr/bin"
if (grepl(searchLocation,pattern = ":")) stop("You are running Linux - please choose a suitable searchLocation argument" )
else link = link2GI::searchSAGAX(MP = searchLocation,quiet = quiet)
}
Expand Down
4 changes: 2 additions & 2 deletions docs/404.html

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 07f2c50

Please sign in to comment.