Skip to content

Commit b74fe44

Browse files
committed
Actually include filename in File.stat ENOENT error.
1 parent 2c7792d commit b74fe44

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

core/src/main/java/org/jruby/RubyFileStat.java

+4-2
Original file line numberDiff line numberDiff line change
@@ -107,15 +107,17 @@ private void setup(FileDescriptor descriptor) {
107107
}
108108

109109
private void setup(String filename, boolean lstat) {
110+
Ruby runtime = getRuntime();
111+
110112
if (Platform.IS_WINDOWS && filename.length() == 2
111113
&& filename.charAt(1) == ':' && Character.isLetter(filename.charAt(0))) {
112114
filename += "/";
113115
}
114116

115-
file = JRubyFile.createResource(getRuntime().getPosix(), getRuntime().getCurrentDirectory(), filename);
117+
file = JRubyFile.createResource(runtime.getPosix(), runtime.getCurrentDirectory(), filename);
116118
stat = lstat ? file.lstat() : file.stat();
117119

118-
if (stat == null) throw getRuntime().newErrnoFromInt(getRuntime().getPosix().errno());
120+
if (stat == null) throw runtime.newErrnoFromInt(runtime.getPosix().errno(), filename);
119121
}
120122

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

0 commit comments

Comments
 (0)