2

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.

EHS
  • 251
  • 1
  • 2
  • 11
Sty
  • 760
  • 1
  • 9
  • 30

2 Answers2

5

See the section on dyn.load in the 'Writing R Extensions' manual: .Platform$dynlib.ext

Jan van der Laan
  • 8,005
  • 1
  • 20
  • 35
  • That was exactly what I was looking for. I obviously just overlooked that section -.- – Sty Jun 28 '13 at 13:03
0

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.

Community
  • 1
  • 1
Paul Hiemstra
  • 59,984
  • 12
  • 142
  • 149