Browse files

Support Fedora systems without libtidy-devel package.

libtidy-devel creates a symlink from libtidy.so to libtidy.so.MAJOR.
  • Loading branch information...
1 parent a4c72b0 commit fc6b99b835a612b6c96158e0868d4b704f61aa96 @libc committed Feb 14, 2012
Showing with 10 additions and 10 deletions.
  1. +8 −1 lib/tidy_ffi/lib_tidy.rb
  2. +2 −9 lib/tidy_ffi/tidy_ffi_extensions.rb
View
9 lib/tidy_ffi/lib_tidy.rb
@@ -3,7 +3,14 @@
# This file must be lazy loaded!
class TidyFFI::LibTidy #:nodoc:
extend FFI::Library
- ffi_lib TidyFFI.library_path
+
+ paths = Array(TidyFFI.library_path || Dir['/{opt,usr}/{,local/}lib{,64}/libtidy.{dylib,so*}'])
+ begin
+ ffi_lib(*paths)
+ rescue LoadError
+ raise TidyFFI::LibTidyNotInstalled, "didn't find tidy libs on your system. Please install tidy (http://tidy.sourceforge.net/)"
+ end
+
attach_function :tidyReleaseDate, [], :string
View
11 lib/tidy_ffi/tidy_ffi_extensions.rb
@@ -1,12 +1,5 @@
module TidyFFI::TidyFFIExtensions #:nodoc:
- # Sets path to libtidy.{dylib,so}
- def library_path=(path)
- @libtidy_path = path
- end
-
- # Returns path to libtidy.{dylib,so}
- def library_path
- @libtidy_path ||= 'tidy'
- end
+ # Sets and gets path to libtidy.{dylib,so}
+ attr_accessor :library_path
end
TidyFFI.extend TidyFFI::TidyFFIExtensions

0 comments on commit fc6b99b

Please sign in to comment.