diff --git a/lib/ffi/inline/compilers/gcc.rb b/lib/ffi/inline/compilers/gcc.rb index b1a3f88..d2c0431 100644 --- a/lib/ffi/inline/compilers/gcc.rb +++ b/lib/ffi/inline/compilers/gcc.rb @@ -19,7 +19,7 @@ def compile (code, libraries = []) @code = code @libraries = libraries - return output if File.exists?(output) + return output if File.exist?(output) cmd = if RbConfig::CONFIG['target_os'] =~ /mswin|mingw/ "sh -c '#{ldshared} #{ENV['CFLAGS']} -o #{output.shellescape} #{input.shellescape} #{libs}' 2>>#{log.shellescape}" @@ -41,7 +41,7 @@ def digest def input File.join(Inline.directory, "#{digest}.c").tap {|path| - File.open(path, 'w') { |f| f.write(@code) } unless File.exists?(path) + File.open(path, 'w') { |f| f.write(@code) } unless File.exist?(path) } end diff --git a/lib/ffi/inline/compilers/gxx.rb b/lib/ffi/inline/compilers/gxx.rb index c817cbd..1dcdd89 100644 --- a/lib/ffi/inline/compilers/gxx.rb +++ b/lib/ffi/inline/compilers/gxx.rb @@ -17,7 +17,7 @@ def exists? def input File.join(Inline.directory, "#{digest}.cpp").tap {|path| - File.open(path, 'w') { |f| f.write(@code) } unless File.exists?(path) + File.open(path, 'w') { |f| f.write(@code) } unless File.exist?(path) } end diff --git a/lib/ffi/inline/compilers/tcc.rb b/lib/ffi/inline/compilers/tcc.rb index d443cd2..5308992 100644 --- a/lib/ffi/inline/compilers/tcc.rb +++ b/lib/ffi/inline/compilers/tcc.rb @@ -19,7 +19,7 @@ def compile (code, libraries = []) @code = code @libraries = libraries - return output if File.exists?(output) + return output if File.exist?(output) cmd = if RbConfig::CONFIG['target_os'] =~ /mswin|mingw/ "sh -c '#{ldshared} #{ENV['CFLAGS']} #{libs} -o #{output.shellescape} #{input.shellescape}' 2>>#{log.shellescape}" @@ -41,7 +41,7 @@ def digest def input File.join(Inline.directory, "#{digest}.c").tap {|path| - File.open(path, 'w') { |f| f.write(@code) } unless File.exists?(path) + File.open(path, 'w') { |f| f.write(@code) } unless File.exist?(path) } end diff --git a/lib/ffi/inline/inline.rb b/lib/ffi/inline/inline.rb index 2f69168..24b40d6 100644 --- a/lib/ffi/inline/inline.rb +++ b/lib/ffi/inline/inline.rb @@ -21,11 +21,11 @@ def self.directory @directory ||= File.expand_path(File.join(Dir.tmpdir, ".ffi-inline-#{Process.uid}")) end - if File.exists?(@directory) && !File.directory?(@directory) + if File.exist?(@directory) && !File.directory?(@directory) raise 'the FFI_INLINER_PATH exists and is not a directory' end - if !File.exists?(@directory) + if !File.exist?(@directory) FileUtils.mkdir(@directory) end