Skip to content

Commit

Permalink
Mac support (issue #2): look also for .dylib files when default .so f…
Browse files Browse the repository at this point in the history
…iles don't exist
  • Loading branch information
Renaud committed Sep 15, 2014
1 parent 2c7dbcd commit ca8a4af
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 2 deletions.
2 changes: 1 addition & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Package: RcppOctave
Type: Package
Title: Seamless Interface to Octave -- and Matlab
Version: 0.14.3
Version: 0.14.4
Date: 2013-11-07
Author: Renaud Gaujoux
Maintainer: Renaud Gaujoux <renaud@tx.technion.ac.il>
Expand Down
7 changes: 7 additions & 0 deletions NEWS
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
********************
Changes in 0.14.4
********************
FIXES
o Mac support: look also for .dylib files when default .so files don't exist
(issue #2)

********************
Changes in 0.14.3
********************
Expand Down
5 changes: 4 additions & 1 deletion R/package.R
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,10 @@ NULL
}

.load_dep <- function( libdir = Octave.config[['libdir']] ){
dlibs <- file.path(libdir, paste0(Octave.config[['libs']], .Platform$dynlib.ext))
if( is.Mac() && !file.exists(dlibs <- file.path(libdir, paste0(Octave.config[['libs']], .Platform$dynlib.ext))) ){
# on Mac look for .dylib if default .so does not exist
dlibs <- file.path(libdir, paste0(Octave.config[['libs']], ".dylib"))
}
sapply(dlibs, dyn.load)
}

Expand Down
6 changes: 6 additions & 0 deletions R/utils.R
Original file line number Diff line number Diff line change
Expand Up @@ -160,3 +160,9 @@ system_call <- function(...){
}else base::system(..., intern = TRUE)

}

is.Mac <- function(check.gui=FALSE){
is.mac <- (length(grep("darwin", R.version$platform)) > 0)
# return TRUE is running on Mac (adn optionally through GUI)
is.mac && (!check.gui || .Platform$GUI == 'AQUA')
}

0 comments on commit ca8a4af

Please sign in to comment.