Skip to content

Commit

Permalink
Showing 2 changed files with 5 additions and 12 deletions.
10 changes: 1 addition & 9 deletions core/src/main/java/org/jruby/truffle/runtime/core/RubyFile.java
Original file line number Diff line number Diff line change
@@ -49,15 +49,7 @@ public void close() {
}

public static String expandPath(String fileName) {
RubyNode.notDesignedForCompilation();

// TODO(cs): see the other expandPath

try {
return new File(fileName).getCanonicalPath();
} catch (IOException e) {
throw new RuntimeException(e);
}
return expandPath(fileName, null);
}

public static String expandPath(String fileName, String dir) {
Original file line number Diff line number Diff line change
@@ -19,6 +19,7 @@
import org.jruby.truffle.runtime.*;
import org.jruby.truffle.runtime.control.*;
import org.jruby.truffle.runtime.core.RubyArray;
import org.jruby.truffle.runtime.core.RubyFile;
import org.jruby.truffle.runtime.core.RubyString;
import org.jruby.util.cli.Options;

@@ -140,17 +141,17 @@ private boolean requireFile(String fileName, RubyNode currentNode) throws IOExce
return false;
}

final String canonicalFileName = file.getCanonicalPath();
final String expandedPath = RubyFile.expandPath(fileName);

for (Object loaded : Arrays.asList(context.getCoreLibrary().getLoadedFeatures().slowToArray())) {
if (loaded.toString().equals(canonicalFileName)) {
if (loaded.toString().equals(expandedPath)) {
return true;
}
}

context.loadFile(fileName, currentNode);

context.getCoreLibrary().getLoadedFeatures().slowPush(context.makeString(canonicalFileName));
context.getCoreLibrary().getLoadedFeatures().slowPush(context.makeString(expandedPath));

return true;
}

0 comments on commit dac366d

Please sign in to comment.