Skip to content
Permalink
Browse files
[Truffle] The path in $" should only be expanded, not canonicalized.
  • Loading branch information
eregon committed Dec 29, 2014
1 parent 19985d2 commit dac366dd594c49456d548297f18e9f8ce1b2324c
@@ -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) {
@@ -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.