Created
July 5, 2011 15:22
-
-
Save bil-bas/1065047 to your computer and use it in GitHub Desktop.
binaryloader
This file contains 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
app_path = __FILE__.chomp(File.extname(__FILE__)) | |
binary_extensions = %w[.bundle .so] | |
binary_extensions.unshift ".#{RUBY_VERSION[0..2]}.so" if defined? RUBY_VERSION | |
found = binary_extensions.any? do |extension| | |
file = "#{app_path}#{extension}" | |
if File.exist? file | |
require file | |
true | |
else | |
false | |
end | |
end | |
raise "Failed to find binary library to load" unless found |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment