Navigation Menu

Skip to content

Commit

Permalink
Actually include filename in File.stat ENOENT error.
Browse files Browse the repository at this point in the history
  • Loading branch information
headius committed Nov 18, 2014
1 parent 2c7792d commit b74fe44
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions core/src/main/java/org/jruby/RubyFileStat.java
Expand Up @@ -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)
Expand Down

0 comments on commit b74fe44

Please sign in to comment.