Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions lib/ffi/inline/compilers/gcc.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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}"
Expand All @@ -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

Expand Down
2 changes: 1 addition & 1 deletion lib/ffi/inline/compilers/gxx.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
4 changes: 2 additions & 2 deletions lib/ffi/inline/compilers/tcc.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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}"
Expand All @@ -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

Expand Down
4 changes: 2 additions & 2 deletions lib/ffi/inline/inline.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down