Skip to content

Commit

Permalink
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions core/src/main/java/org/jruby/RubyFileStat.java
Original file line number Diff line number Diff line change
@@ -107,15 +107,17 @@ private void setup(FileDescriptor descriptor) {
}

private void setup(String filename, boolean lstat) {
Ruby runtime = getRuntime();

if (Platform.IS_WINDOWS && filename.length() == 2
&& filename.charAt(1) == ':' && Character.isLetter(filename.charAt(0))) {
filename += "/";
}

file = JRubyFile.createResource(getRuntime().getPosix(), getRuntime().getCurrentDirectory(), filename);
file = JRubyFile.createResource(runtime.getPosix(), runtime.getCurrentDirectory(), filename);
stat = lstat ? file.lstat() : file.stat();

if (stat == null) throw getRuntime().newErrnoFromInt(getRuntime().getPosix().errno());
if (stat == null) throw runtime.newErrnoFromInt(runtime.getPosix().errno(), filename);
}

@JRubyMethod(name = "initialize", required = 1, visibility = Visibility.PRIVATE, compat = CompatVersion.RUBY1_8)

0 comments on commit b74fe44

Please sign in to comment.