diff --git a/platform/lang-impl/src/com/intellij/ide/scratch/ScratchFileServiceImpl.java b/platform/lang-impl/src/com/intellij/ide/scratch/ScratchFileServiceImpl.java index c6cbd7554700..1159c19c5742 100644 --- a/platform/lang-impl/src/com/intellij/ide/scratch/ScratchFileServiceImpl.java +++ b/platform/lang-impl/src/com/intellij/ide/scratch/ScratchFileServiceImpl.java @@ -153,7 +153,7 @@ public class ScratchFileServiceImpl extends ScratchFileService implements Persis @NotNull protected String getRootPath() { - return FileUtil.toSystemIndependentName(PathManager.getConfigPath()); + return FileUtil.toSystemIndependentName(PathManager.getScratchPath()); } @NotNull diff --git a/platform/util/src/com/intellij/openapi/application/PathManager.java b/platform/util/src/com/intellij/openapi/application/PathManager.java index 7a1c79aa83de..3402afa0afb2 100644 --- a/platform/util/src/com/intellij/openapi/application/PathManager.java +++ b/platform/util/src/com/intellij/openapi/application/PathManager.java @@ -15,7 +15,10 @@ */ package com.intellij.openapi.application; -import com.intellij.openapi.util.*; +import com.intellij.openapi.util.NamedJDOMExternalizable; +import com.intellij.openapi.util.Pair; +import com.intellij.openapi.util.SystemInfo; +import com.intellij.openapi.util.SystemInfoRt; import com.intellij.openapi.util.io.FileUtil; import com.intellij.openapi.util.text.StringUtil; import com.intellij.util.io.URLUtil; @@ -45,6 +48,7 @@ public class PathManager { public static final String PROPERTY_HOME_PATH = "idea.home.path"; public static final String PROPERTY_CONFIG_PATH = "idea.config.path"; public static final String PROPERTY_SYSTEM_PATH = "idea.system.path"; + public static final String PROPERTY_SCRATCH_PATH = "idea.scratch.path"; public static final String PROPERTY_PLUGINS_PATH = "idea.plugins.path"; public static final String PROPERTY_LOG_PATH = "idea.log.path"; public static final String PROPERTY_PATHS_SELECTOR = "idea.paths.selector"; @@ -66,6 +70,7 @@ public class PathManager { private static String ourHomePath; private static String ourConfigPath; private static String ourSystemPath; + private static String ourScratchPath; private static String ourPluginsPath; private static String ourLogPath; @@ -168,6 +173,20 @@ public class PathManager { return ourConfigPath; } + @NotNull + public static String getScratchPath() { + if (ourScratchPath != null) return ourScratchPath; + + if (System.getProperty(PROPERTY_SCRATCH_PATH) != null) { + ourScratchPath = getAbsolutePath(trimPathQuotes(System.getProperty(PROPERTY_SCRATCH_PATH))); + } + else { + ourScratchPath = getConfigPath(); + } + + return ourScratchPath; + } + @NotNull public static String getDefaultConfigPathFor(@NotNull String selector) { return platformPath(selector, "Library/Preferences", CONFIG_FOLDER);