Skip to content

Commit

Permalink
require FFI and qualify a few constants
Browse files Browse the repository at this point in the history
  • Loading branch information
enebo committed May 26, 2016
1 parent 1a69b11 commit dc26126
Showing 1 changed file with 10 additions and 5 deletions.
15 changes: 10 additions & 5 deletions core/src/main/ruby/jruby/kernel/file.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
# Windows symlink support borrowed from djberg96/win32-file and ffi-win32-extensions

if org.jruby.platform.Platform::IS_WINDOWS

require 'ffi'

module JRuby
module Windows
module File
Expand Down Expand Up @@ -77,9 +78,9 @@ class WIN32_FIND_DATA < FFI::Struct
end

class File
include Windows::File::Constants
include Windows::File::Structs
extend Windows::File::Functions
include JRuby::Windows::File::Constants
include JRuby::Windows::File::Structs
extend JRuby::Windows::File::Functions

# Creates a symbolic link called +new_name+ for the file or directory
# +old_name+.
Expand All @@ -101,6 +102,8 @@ def self.symlink(target, link)
end

0 # Comply with spec
ensure
puts $!
end

# Returns whether or not +file+ is a symlink.
Expand Down Expand Up @@ -135,6 +138,8 @@ def self.symlink?(file)
end

bool
ensure
puts $!
end

private
Expand All @@ -156,4 +161,4 @@ def wincode
(self.tr(File::SEPARATOR, File::ALT_SEPARATOR) + 0.chr).encode('UTF-16LE')
end
end
end
end

0 comments on commit dc26126

Please sign in to comment.