Created
October 28, 2025 07:50
-
-
Save oousmane/4276c47ce747a73d8f69906b06fd2091 to your computer and use it in GitHub Desktop.
Consistent way to detect os automatically by the creator of geoplumber
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| get_os <- function(){ | |
| sysinf <- Sys.info() | |
| if (!is.null(sysinf)){ | |
| os <- sysinf['sysname'] | |
| if (os == 'Darwin') | |
| os <- "osx" | |
| } else { ## mystery machine | |
| os <- .Platform$OS.type | |
| if (grepl("^darwin", R.version$os)) | |
| os <- "osx" | |
| if (grepl("linux-gnu", R.version$os)) | |
| os <- "linux" | |
| } | |
| tolower(os) | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment