Or, generally speaking, is there a portable way to determine whether a file is a .so/.dll/.dylib using built-in R functions?
I simply refuse to believe that there isn't a more portable way than checking file_ext() with a case-statement.
Or, generally speaking, is there a portable way to determine whether a file is a .so/.dll/.dylib using built-in R functions?
I simply refuse to believe that there isn't a more portable way than checking file_ext() with a case-statement.
See the section on dyn.load in the 'Writing R Extensions' manual: .Platform$dynlib.ext
I think checking the extension is fine, but an alternative is to determine which platform you are one. You can do that with Sys.info(), more specifically Sys.info()['sysname'], see also this question. For example, on my system:
> Sys.info()['sysname']
sysname
"Darwin"
Shows that I work on a Mac OS system. Linux users see Linux, and windows users presumable Windows.