git ssb

0+

dangerousbeans / %aPBe2k3ugtjBr4rrsU1…



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.rbchanged
lib/bcrypt.rbView
@@ -3,10 +3,16 @@
33 if RUBY_PLATFORM == "java"
44 require 'java'
55 $CLASSPATH << File.expand_path(File.join(File.dirname(__FILE__), "..", "ext", "jruby"))
66 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+
915 require "openssl"
1016 end
1117
1218 # A Ruby library implementing OpenBSD's bcrypt()/crypt_blowfish algorithm for

Built with git-ssb-web