summaryrefslogtreecommitdiffstats
path: root/lib/vendor/tmail-1.2.7/tmail/require_arch.rb
diff options
context:
space:
mode:
authorJean-Philippe Lang <jp_lang@yahoo.fr>2012-04-25 17:17:49 +0000
committerJean-Philippe Lang <jp_lang@yahoo.fr>2012-04-25 17:17:49 +0000
commit5e57a1a9d9478162ac4f27ae96b2ccaf55a1aba7 (patch)
tree93e57765139714bd82dede475725516c448c0d55 /lib/vendor/tmail-1.2.7/tmail/require_arch.rb
parent34e20c4373b7f5a20ab3a132feae3f70f21ec477 (diff)
downloadredmine-5e57a1a9d9478162ac4f27ae96b2ccaf55a1aba7.tar.gz
redmine-5e57a1a9d9478162ac4f27ae96b2ccaf55a1aba7.zip
Merged rails-3.2 branch.
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@9528 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'lib/vendor/tmail-1.2.7/tmail/require_arch.rb')
-rw-r--r--lib/vendor/tmail-1.2.7/tmail/require_arch.rb58
1 files changed, 58 insertions, 0 deletions
diff --git a/lib/vendor/tmail-1.2.7/tmail/require_arch.rb b/lib/vendor/tmail-1.2.7/tmail/require_arch.rb
new file mode 100644
index 000000000..b4fffb8ab
--- /dev/null
+++ b/lib/vendor/tmail-1.2.7/tmail/require_arch.rb
@@ -0,0 +1,58 @@
+#:stopdoc:
+require 'rbconfig'
+
+# Attempts to require anative extension.
+# Falls back to pure-ruby version, if it fails.
+#
+# This uses Config::CONFIG['arch'] from rbconfig.
+
+def require_arch(fname)
+ arch = Config::CONFIG['arch']
+ begin
+ path = File.join("tmail", arch, fname)
+ require path
+ rescue LoadError => e
+ # try pre-built Windows binaries
+ if arch =~ /mswin/
+ require File.join("tmail", 'mswin32', fname)
+ else
+ raise e
+ end
+ end
+end
+
+
+# def require_arch(fname)
+# dext = Config::CONFIG['DLEXT']
+# begin
+# if File.extname(fname) == dext
+# path = fname
+# else
+# path = File.join("tmail","#{fname}.#{dext}")
+# end
+# require path
+# rescue LoadError => e
+# begin
+# arch = Config::CONFIG['arch']
+# path = File.join("tmail", arch, "#{fname}.#{dext}")
+# require path
+# rescue LoadError
+# case path
+# when /i686/
+# path.sub!('i686', 'i586')
+# when /i586/
+# path.sub!('i586', 'i486')
+# when /i486/
+# path.sub!('i486', 'i386')
+# else
+# begin
+# require fname + '.rb'
+# rescue LoadError
+# raise e
+# end
+# end
+# retry
+# end
+# end
+# end
+#:startdoc: \ No newline at end of file