From 95f0331a129a0f8901ad2d94d212c25e8a8b49ed Mon Sep 17 00:00:00 2001 From: Chris Reudenbach Date: Tue, 23 Apr 2024 19:05:44 +0200 Subject: [PATCH] #63 --- R/gdalControls.R | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/R/gdalControls.R b/R/gdalControls.R index fef26bc..4cce3c3 100644 --- a/R/gdalControls.R +++ b/R/gdalControls.R @@ -56,9 +56,10 @@ setenvGDAL <- function(bin_GDAL = NULL){ #' searchGDALW() #' } -searchGDALW <- function(DL = "C:", +searchGDALW <- function(DL = "C:/", quiet=TRUE) { - if (DL=="default") DL <- "C:" + if (DL=="C:") DL <- "C:/" + if (DL=="default") DL <- "C:/" if (Sys.info()["sysname"] == "Windows") { if (!exists("GiEnv")) GiEnv <- new.env(parent=globalenv()) @@ -69,10 +70,10 @@ searchGDALW <- function(DL = "C:", DL = gsub("\\\\", "/", DL) DL = gsub("/", "\\\\", DL) - DL = shQuote(DL) + DL = shortPathName(DL) options(show.error.messages = FALSE) options(warn=-1) - raw_GDAL <- try(system(paste0("cmd.exe /c dir /B /S ",DL,"gdalinfo.exe"),intern=TRUE)) + raw_GDAL <- try(system(paste0("cmd.exe /c WHERE /R ",DL, " ","gdalinfo.exe"),intern=TRUE)) if (identical(raw_GDAL, character(0))) raw_GDAL <- "File not found" if (any(grepl(raw_GDAL,pattern = "File not found")) | any(grepl(raw_GDAL,pattern = "Datei nicht gefunden"))) {