Commit 4f0c859c authored by Andre Gohr's avatar Andre Gohr
Browse files

expression explorer sets browser option according to detected OS type to be more versatile

parent 3b055699
......@@ -10,9 +10,29 @@ $(which Rscript) -<<"EOF" ${SCRIPT_DIRECTORY}
args = commandArgs(trailingOnly = TRUE)
# helper function to detect OS this shinyapp is running on
get_os <- function(){
os <- "mac" # a-priori guess
sysinf <- Sys.info()
if (!is.null(sysinf)){
os <- sysinf['sysname']
if (os == 'Darwin'){os <- "mac"}
}else{ ## mystery machine
os <- .Platform$OS.type
if (grepl("^darwin", R.version$os)){os <- "mac"}
if (grepl("linux-gnu", R.version$os)){os <- "linux"}
}
tolower(os)
}
os.detected=get_os()
# Setting browser avoids: Error in utils::browseURL(hu$url) : 'browser' must be a non-empty character string
# Set browser to chrome for Chrome, or ie or "path/to/IE" for Internet explorer, or safari for Safari...
options(browser = 'firefox')
if(os.detected=="windows"){options(browser = NULL)} # NULL -> default browser fill be used
if(os.detected=="mac"){options(browser = "open")} # open will be used to open html file
if(os.detected=="linux"){options(browser = "xdg-open")} # xdg-open will be used to open html file
# Determine data directory from execution context ---------------------------------------------------------------------
dataPath= args[1]
......
......@@ -10,9 +10,27 @@
# http://rstudio.github.io/DT/
# helper function to detect OS this shinyapp is running on
get_os <- function(){
os <- "mac" # a-priori guess
sysinf <- Sys.info()
if (!is.null(sysinf)){
os <- sysinf['sysname']
if (os == 'Darwin'){os <- "mac"}
}else{ ## mystery machine
os <- .Platform$OS.type
if (grepl("^darwin", R.version$os)){os <- "mac"}
if (grepl("linux-gnu", R.version$os)){os <- "linux"}
}
tolower(os)
}
os.detected=get_os()
# Setting browser avoids: Error in utils::browseURL(hu$url) : 'browser' must be a non-empty character string
# Set browser to chrome for Chrome, or ie or "path/to/IE" for Internet explorer, or safari for Safari...
options(browser = 'firefox')
if(os.detected=="windows"){options(browser = NULL)} # NULL -> default browser fill be used
if(os.detected=="mac"){options(browser = "open")} # open will be used to open html file
if(os.detected=="linux"){options(browser = "xdg-open")} # xdg-open will be used to open html file
# When this script is run inside the DGE folder with Rscript, then
# the dataPath should be '.'. Otherwise change this variable to
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment