mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
EA-34442 (check config/system paths validity on start)
This commit is contained in:
@@ -99,6 +99,26 @@ public class StartupUtil {
|
||||
return true;
|
||||
}
|
||||
|
||||
private synchronized static boolean checkSystemFolders() {
|
||||
final String configPath = PathManager.getConfigPath();
|
||||
if (configPath == null || !new File(configPath).isDirectory()) {
|
||||
showError("Invalid config path", "Config path '" + configPath + "' is invalid.\n" +
|
||||
"If you have modified the 'idea.config.path' property please make sure it is correct,\n" +
|
||||
"otherwise please re-install the IDE.");
|
||||
return false;
|
||||
}
|
||||
|
||||
final String systemPath = PathManager.getSystemPath();
|
||||
if (systemPath == null || !new File(systemPath).isDirectory()) {
|
||||
showError("Invalid system path", "System path '" + systemPath + "' is invalid.\n" +
|
||||
"If you have modified the 'idea.system.path' property please make sure it is correct,\n" +
|
||||
"otherwise please re-install the IDE.");
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
private synchronized static boolean lockSystemFolders(String[] args) {
|
||||
if (ourLock == null) {
|
||||
ourLock = new SocketLock();
|
||||
@@ -169,12 +189,14 @@ public class StartupUtil {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
static boolean checkStartupPossible(String[] args) {
|
||||
return checkJdkVersion() && lockSystemFolders(args) && checkTmpIsAccessible();
|
||||
return checkJdkVersion() &&
|
||||
checkTmpIsAccessible() &&
|
||||
checkSystemFolders() &&
|
||||
lockSystemFolders(args);
|
||||
}
|
||||
|
||||
static void runStartupWizard() {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2009 JetBrains s.r.o.
|
||||
* Copyright 2000-2012 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -156,11 +156,11 @@ public class PathManager {
|
||||
public static boolean ensureConfigFolderExists(final boolean createIfNotExists) {
|
||||
getConfigPathWithoutDialog();
|
||||
|
||||
File file = new File(ourConfigPath);
|
||||
final File file = new File(ourConfigPath);
|
||||
if (createIfNotExists && !file.exists()) {
|
||||
file.mkdirs();
|
||||
return true;
|
||||
return file.mkdirs(); // shouldn't copy configs if failed to create new directory
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user