Skip to content

Commit a3fadff

Browse files
committed
Fix: adapt core home detection to new MX dir structure.
1 parent 8f8d0e7 commit a3fadff

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

graalpython/com.oracle.graal.python.test/src/com/oracle/graal/python/test/GraalPythonEnvVars.java

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -57,11 +57,13 @@ private static String discoverHomeFromSource() throws IOException {
5757
final Path codeDir = codeLocation.getParent();
5858

5959
// executing from jar file in source tree
60-
if (codeDir.endsWith(Paths.get("mxbuild", "dists"))) {
61-
final Path candidate = codeDir.getParent().getParent().resolve("graalpython");
62-
if (isGraalPythonHome(candidate)) {
63-
// Jar source build
64-
return candidate.toFile().getCanonicalPath().toString();
60+
for (Path cur = codeDir; cur.getNameCount() >= 2; cur = cur.getParent()) {
61+
if (cur.endsWith(Paths.get("mxbuild", "dists"))) {
62+
final Path candidate = cur.getParent().getParent().resolve("graalpython");
63+
if (isGraalPythonHome(candidate)) {
64+
// Jar source build
65+
return candidate.toFile().getCanonicalPath().toString();
66+
}
6567
}
6668
}
6769

0 commit comments

Comments
 (0)