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 e1d0d1a commit 792530e
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 @@ -122,15 +122,17 @@ private void setup(int fileno) {
}

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);
}

public IRubyObject initialize(IRubyObject fname, Block unusedBlock) {
Expand Down

0 comments on commit 792530e

Please sign in to comment.