Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

JRUBY-2722 for real this time AND Rails works

git-svn-id: http://svn.codehaus.org/jruby/trunk/jruby@7205 961051c9-f516-0410-bf72-c9f7e237a7b7
  • Loading branch information...
commit 1561011443e9a61505d31b7028506ceb2a952232 1 parent 10b0ce3
@enebo enebo authored
View
11 src/org/jruby/Ruby.java
@@ -1830,15 +1830,6 @@ public IRubyObject setValue(IRubyObject newValue) {
public void defineReadonlyVariable(String name, IRubyObject value) {
globalVariables.defineReadonly(name, new ValueAccessor(value));
}
-
- /* FIXME: Helper method...we need to do something better than this */
- private String tweakPath(String filename) {
- File f = new File(filename);
-
- if (f.exists() && !f.isAbsolute() && !filename.startsWith("./")) filename = "./" + filename;
-
- return filename;
- }
public Node parseFile(InputStream in, String file, DynamicScope scope) {
return parser.parse(file, in, scope, new ParserConfiguration(0, false, false, true));
@@ -2036,8 +2027,6 @@ private void printErrorPos(ThreadContext context, PrintStream errorStream) {
}
public void loadFile(String scriptName, InputStream in, boolean wrap) {
- if (!Ruby.isSecurityRestricted()) scriptName = tweakPath(scriptName);
-
IRubyObject self = wrap ? TopSelfFactory.createTopSelf(this) : getTopSelf();
ThreadContext context = getCurrentContext();
String file = context.getFile();
View
5 src/org/jruby/runtime/load/LoadService.java
@@ -494,7 +494,10 @@ private LoadServiceResource findFile(String name, boolean checkCWD) {
RubyFile.expandUserPath(runtime.getCurrentContext(), name));
if (current.isFile()) {
try {
- return new LoadServiceResource(current.toURI().toURL(), current.getPath());
+ // relative paths without ./ on front get absolute path
+ String resourcePath = name.startsWith("./") ? name : current.getPath();
+
+ return new LoadServiceResource(current.toURI().toURL(), resourcePath);
} catch (MalformedURLException e) {
throw runtime.newIOErrorFromException(e);
}
Please sign in to comment.
Something went wrong with that request. Please try again.