Introduce SetUpJsModuleAction

Refactor PathUtil
This commit is contained in:
pTalanov
2012-05-22 13:51:48 +04:00
parent 67491a224d
commit 18ce0ac722
5 changed files with 152 additions and 12 deletions
@@ -31,6 +31,9 @@ import java.util.ArrayList;
import java.util.List;
public class PathUtil {
public static String JS_LIB_JAR_NAME = "kotlin-jslib.jar";
private PathUtil() {}
public static File getDefaultCompilerPath() {
@@ -66,20 +69,28 @@ public class PathUtil {
@Nullable
public static File getDefaultRuntimePath() {
return getFilePackedIntoLib("kotlin-runtime.jar");
}
@Nullable
public static File getDefaultJsLibPath() {
return getFilePackedIntoLib(JS_LIB_JAR_NAME);
}
@Nullable
private static File getFilePackedIntoLib(@NotNull String filePathFromLib) {
File compilerPath = getDefaultCompilerPath();
if (compilerPath == null) return null;
File answer = new File(compilerPath, "lib/kotlin-runtime.jar");
File answer = new File(compilerPath, "lib/" + filePathFromLib);
return answer.exists() ? answer : null;
}
@Nullable
public static File getAltHeadersPath() {
File compilerPath = getDefaultCompilerPath();
if (compilerPath == null) return null;
File answer = new File(compilerPath, "lib/alt/kotlin-jdk-headers.jar");
return answer.exists() ? answer : null;
return getFilePackedIntoLib("alt/kotlin-jdk-headers.jar");
}
@NotNull