Commit 974b0f6e889d995cc06959c3de9fb0bb3cff8eee
Only append ../ext/ path if bcrypt_ext require fails and ../ext exists
Signed-off-by: Coda Hale <coda.hale@gmail.com>Joshua Peek authored on 4/23/2010, 2:48:29 AM
Coda Hale committed on 4/23/2010, 3:59:22 AM
Parent: c85bc646b8251f3b4f7365d63752a813c2733409
Files changed
lib/bcrypt.rb | changed |
lib/bcrypt.rb | ||
---|---|---|
@@ -3,10 +3,16 @@ | ||
3 | 3 | if RUBY_PLATFORM == "java" |
4 | 4 | require 'java' |
5 | 5 | $CLASSPATH << File.expand_path(File.join(File.dirname(__FILE__), "..", "ext", "jruby")) |
6 | 6 | else |
7 | - $LOAD_PATH.unshift(File.expand_path(File.join(File.dirname(__FILE__), "..", "ext", "mri"))) | |
8 | - require "bcrypt_ext" | |
7 | + begin | |
8 | + require "bcrypt_ext" | |
9 | + rescue LoadError | |
10 | + extdir = File.expand_path(File.join(File.dirname(__FILE__), "..", "ext", "mri")) | |
11 | + $LOAD_PATH.unshift(extdir) if File.directory?(extdir) && !$LOAD_PATH.include?(extdir) | |
12 | + require "bcrypt_ext" | |
13 | + end | |
14 | + | |
9 | 15 | require "openssl" |
10 | 16 | end |
11 | 17 | |
12 | 18 | # A Ruby library implementing OpenBSD's bcrypt()/crypt_blowfish algorithm for |
Built with git-ssb-web