diff --git a/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/REnvVars.java b/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/REnvVars.java index 5afd1a8ca0db8bf5f2d2692e82fcc17128b4adc5..f7a95a1b4b7559639bf3c2a73e7854c21f96bba1 100644 --- a/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/REnvVars.java +++ b/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/REnvVars.java @@ -161,7 +161,7 @@ public final class REnvVars implements RContext.ContextState { * The only time this can happen legitimately is when run under the graalvm shell, * which does not execute the shell script that normally sets R_HOME. */ - rHomePath = Paths.get(REnvVars.class.getProtectionDomain().getCodeSource().getLocation().getPath()).getParent(); + rHomePath = getRHomePath(); } else { rHomePath = Paths.get(rHome); } @@ -175,6 +175,13 @@ public final class REnvVars implements RContext.ContextState { return rHome; } + /** + * Separated for substitution in AOT environment. + */ + private static Path getRHomePath() { + return Paths.get(REnvVars.class.getProtectionDomain().getCodeSource().getLocation().getPath()).getParent(); + } + private void checkRHome() { String envRHome = envVars.get(R_HOME); if (envRHome == null) {