/usr/lib/ruby/vendor_ruby/kakasi/platform.rb is in ruby-kakasi-ffi 1.0.2-2.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 | module Kakasi
module Lib
if defined?(::FFI::Platform)
LIBPREFIX = ::FFI::Platform::LIBPREFIX
LIBSUFFIX = ::FFI::Platform::LIBSUFFIX
else
LIBPREFIX =
case RbConfig::CONFIG['host_os']
when /mingw|mswin/i
''.freeze
when /cygwin/i
'cyg'.freeze
else
'lib'.freeze
end
LIBSUFFIX =
case RbConfig::CONFIG['host_os']
when /darwin/i
'dylib'.freeze
when /mingw|mswin|cygwin/i
'dll'.freeze
else
'so'.freeze
end
end
DEFLIBPATH =
begin
[RbConfig::CONFIG['libdir']] |
case RbConfig::CONFIG['host_os']
when /mingw|mswin/i
[]
else
%w[/lib /usr/lib]
end
end.freeze
class << self
def try_load(libpath = LIBPATH)
basename = map_library_name('kakasi')
(libpath | DEFLIBPATH).each { |dir|
filename = File.join(dir, basename)
begin
yield filename
rescue LoadError
next
rescue
next
end
return filename
}
begin
yield basename
rescue LoadError
raise
rescue
raise LoadError, $!.message
end
return basename
end
private
def map_library_name(name)
"#{LIBPREFIX}#{name}.#{LIBSUFFIX}"
end
end
end
end
|