diff options
author | Tor Norbye <tnorbye@google.com> | 2014-07-16 09:01:01 -0700 |
---|---|---|
committer | Tor Norbye <tnorbye@google.com> | 2014-07-16 17:30:47 +0000 |
commit | 3dc53513db1a072e47e4b2c0c111ba4b91e4d709 (patch) | |
tree | 4f056fa40e83284e2b3d3f02a1710b0b9cad3f53 /platform | |
parent | 0a3043f44b7aa23f4153ebe41c27c6ae896e6a2d (diff) | |
download | idea-3dc53513db1a072e47e4b2c0c111ba4b91e4d709.tar.gz |
72680: Handle Studio settings upgrades more automatically
When you run AndroidStudioBeta or AndroidStudio for the first time, make the
import helper aware of our previous settings directory names (AndroidStudioPreview,
AndroidStudioBeta) such that it can default to suggesting an import location which
migrates the settings. Prior to this fix (which unfortunately meant this happened in
beta) users would simply be pointed to the /Applications folder on Mac (probably
something similar on other platforms) and if they had already replaced their preview
install with beta, it wasn't clear what to do.
Change-Id: If004f2b652df51f11f47622ea991a6dd01885af5
(cherry picked from commit 632b69da7bada0ba2eb0936f668a341de5564a73)
Diffstat (limited to 'platform')
-rw-r--r-- | platform/platform-impl/src/com/intellij/openapi/application/ConfigImportHelper.java | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/platform/platform-impl/src/com/intellij/openapi/application/ConfigImportHelper.java b/platform/platform-impl/src/com/intellij/openapi/application/ConfigImportHelper.java index 36bd876c15b4..ed40589a7d20 100644 --- a/platform/platform-impl/src/com/intellij/openapi/application/ConfigImportHelper.java +++ b/platform/platform-impl/src/com/intellij/openapi/application/ConfigImportHelper.java @@ -133,6 +133,27 @@ public class ConfigImportHelper { maxFile = file; } } + + // Android Studio: Attempt to find user settings from earlier versions where the settings names + // are different from the current setting name + if (maxFile == null) { + File preview = new File(PathManager.getDefaultConfigPathFor("AndroidStudioPreview")); + File beta = new File(PathManager.getDefaultConfigPathFor("AndroidStudioBeta")); // relevant when we switch from beta to stable + for (File file : new File[] { preview, beta }) { + if (!file.isDirectory()) { + continue; + } + File options = new File(file, CONFIG_RELATED_PATH + OPTIONS_XML); + if (options.exists()) { + final long modified = options.lastModified(); + if (modified > lastModified) { + lastModified = modified; + maxFile = file; + } + } + } + } + return maxFile != null ? new File(maxFile, CONFIG_RELATED_PATH) : null; } |