fix sdk finding

This commit is contained in:
Maxim Manuylov
2012-07-22 21:14:06 +04:00
committed by Evgeny Gerashchenko
parent 843fb8d7a9
commit b6258beb87
3 changed files with 68 additions and 24 deletions
@@ -69,6 +69,15 @@ public class PathUtil {
return answer.exists() ? answer : null;
}
@Nullable
public static File getSDKHomeByCompilerPath(@Nullable final File compilerPath) {
if (compilerPath == null) return null;
final File libDir = compilerPath.getParentFile();
if (libDir == null) return null;
final File sdkHome = libDir.getParentFile();
return sdkHome != null && sdkHome.exists() ? sdkHome : null;
}
@NotNull
public static VirtualFile jarFileOrDirectoryToVirtualFile(@NotNull File file) {
if (file.exists()) {