Skip to content

Commit

Permalink
Support Fedora systems without libtidy-devel package.
Browse files Browse the repository at this point in the history
libtidy-devel creates a symlink from libtidy.so to libtidy.so.MAJOR.
  • Loading branch information
libc committed Feb 14, 2012
1 parent a4c72b0 commit fc6b99b
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 10 deletions.
9 changes: 8 additions & 1 deletion lib/tidy_ffi/lib_tidy.rb
Expand Up @@ -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

Expand Down
11 changes: 2 additions & 9 deletions 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.