diff --git a/platform/platform-impl/src/com/intellij/idea/StartupUtil.java b/platform/platform-impl/src/com/intellij/idea/StartupUtil.java index d144ba429f34..5412e6e1f3eb 100644 --- a/platform/platform-impl/src/com/intellij/idea/StartupUtil.java +++ b/platform/platform-impl/src/com/intellij/idea/StartupUtil.java @@ -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() { diff --git a/platform/util/src/com/intellij/openapi/application/PathManager.java b/platform/util/src/com/intellij/openapi/application/PathManager.java index c053d8f6b176..d9ef319b731f 100644 --- a/platform/util/src/com/intellij/openapi/application/PathManager.java +++ b/platform/util/src/com/intellij/openapi/application/PathManager.java @@ -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; }