Skip to content

Commit

Permalink
Improved how RUBYSDLFFI_PATH and SDL_PATHS are processed.
Browse files Browse the repository at this point in the history
  • Loading branch information
jacius committed Aug 8, 2010
1 parent 6df08e9 commit b3e5483
Showing 1 changed file with 6 additions and 10 deletions.
16 changes: 6 additions & 10 deletions lib/ruby-sdl-ffi/sdl.rb
Expand Up @@ -35,21 +35,17 @@ module SDL
extend NiceFFI::Library

unless defined? SDL::LOAD_PATHS
# Check if the application has defined SDL_PATHS with some
# paths to check first for SDL libraries.
SDL::LOAD_PATHS = NiceFFI::PathSet::DEFAULT.dup

rubysdlffi_path = ENV["RUBYSDLFFI_PATH"]
if rubysdlffi_path and not rubysdlffi_path.empty?
rubysdlffi_path = rubysdlffi_path.split( File::PATH_SEPARATOR ).compact
paths = rubysdlffi_path.split( File::PATH_SEPARATOR ).compact
SDL::LOAD_PATHS.prepend!(paths)
end

SDL::LOAD_PATHS = if rubysdlffi_path
NiceFFI::PathSet::DEFAULT.prepend( rubysdlffi_path )
elsif defined? ::SDL_PATHS
NiceFFI::PathSet::DEFAULT.prepend( ::SDL_PATHS )
else
NiceFFI::PathSet::DEFAULT
end
if defined? ::SDL_PATHS
SDL::LOAD_PATHS.prepend!(::SDL_PATHS)
end
end

load_library "SDL", SDL::LOAD_PATHS
Expand Down

0 comments on commit b3e5483

Please sign in to comment.