getsystem <- function() paste0(Sys.info()["sysname"])
#' Define the GAMA path
#'
#' Define the path of GAMA Java plugins.
#'
#' @param path Absolute path to the GAMA folder.
#' @keywords internal
defpath <- function(path) {
# if we use OSX, the plugin is located in the Contents/eclipse sub directory of
# gama otherwise it is at its root:
subpath <- ifelse(getsystem() == "Darwin", "/Contents/eclipse", "")
gamapath <- paste0(path, subpath, "/plugins")
plugins <- grep("org.eclipse.equinox.launcher_.*", dir(gamapath), value = TRUE)
options(gamar.plugins = paste(paste0(gamapath, "/", plugins), collapse = ":"))
options(gamar.startjar = paste0(gamapath, "/", plugins))
options(gamar.Xmx = "2048m")
options(gamar.Xms = "512m")
}
# ------------------------------------------------------------------------------
.onAttach <- function(...) {
gamapath <- "/Applications/Gama.app"
if (getsystem() == "Darwin" & file.exists(gamapath)) {
defpath(gamapath)
packageStartupMessage(paste0("Using GAMA executable in ", gamapath))
} else {
packageStartupMessage("WARNINGS: (1) make sure that GAMA (v >= 1.7.0) is installed on your machine.")
packageStartupMessage(" if not, check www.gama-platform.org for installation instructions.")
packageStartupMessage(" (2) define the path to GAMA by typing:")
packageStartupMessage(" defpath('path_to_your_GAMA_executable')")
}
}
################################################################################
.onDetach <- function(...) {
options(gamar.plugins = NULL)
options(gamar.startjar = NULL)
options(gamar.Xmx = NULL)
options(gamar.Xms = NULL)
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.