Skip to content

Commit

Permalink
Fixes #4745. (SystemCallError) Unknown error 123 - FindFirstFile with…
Browse files Browse the repository at this point in the history
… AsciidoctorJ-PDF on Win10

doh...9.1.9.0 was the first version to actually start calling this .symlink? impl
and it does not work with uris.  A comedy of errors I think ended up masking this
implementation out in 9.1.3.0.

This rolls with the original patch @headius made but I moved some stuff around a
tiny bit.
enebo committed Aug 30, 2017

Unverified

This user has not yet uploaded their public signing key.
1 parent 95f6a36 commit fd5e414
Showing 1 changed file with 6 additions and 8 deletions.
14 changes: 6 additions & 8 deletions core/src/main/ruby/jruby/kernel/file.rb
Original file line number Diff line number Diff line change
@@ -125,11 +125,12 @@ def self.symlink(target, link)
# Returns whether or not +file+ is a symlink.
#
def self.symlink?(file)
return false unless File.exist?(file)
file = string_check(file)

bool = false
wfile = string_check(file).wincode
return false if file =~ /^(classpath:|classloader:|uri:classloader|jar:)/ || !File.exist?(file)

file.slice!(5..-1) if file =~ /^file:/
wfile = checked.wincode
attrib = GetFileAttributesW(wfile)

if attrib == INVALID_FILE_ATTRIBUTES
@@ -145,15 +146,12 @@ def self.symlink?(file)
raise SystemCallError.new('FindFirstFile', FFI.errno)
end

if find_data[:dwReserved0] == IO_REPARSE_TAG_SYMLINK
bool = true
end
return true if find_data[:dwReserved0] == IO_REPARSE_TAG_SYMLINK
ensure
CloseHandle(handle)
end
end

bool
false
end

private

0 comments on commit fd5e414

Please sign in to comment.