Skip to content

Commit

Permalink
[Truffle] The path in $" should only be expanded, not canonicalized.
Browse files Browse the repository at this point in the history
  • Loading branch information
eregon committed Dec 29, 2014
1 parent 19985d2 commit dac366d
Show file tree
Hide file tree
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
Expand Up @@ -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) {
Expand Down
Expand Up @@ -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;

Expand Down Expand Up @@ -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;
}
Expand Down

0 comments on commit dac366d

Please sign in to comment.