@@ -95,11 +95,28 @@ class IdeaContext {
95
95
96
96
static function findLatestPreferences (): Array <String > {
97
97
var result = [];
98
- var prefsPath = getUserPreferencesPath ();
99
- var ideaPathName = CL .platform .isMac ? " IntelliJIdea" : " .IntelliJIdea" ;
100
- var versions = getVersions ();
101
98
102
- MakeLog .trace (' Search IntelliJ IDEA Preferences in: $prefsPath ' );
99
+ // check versions 20.x and above
100
+ var prefsPath = Path .join ([getUserAppDataPath (), " JetBrains" ]);
101
+ var ideaPathName = " IntelliJIdea" ;
102
+ var versions = getVersions (20 , 21 );
103
+
104
+ MakeLog .trace (' Search IntelliJ IDEA 20.x Preferences in: $prefsPath ' );
105
+
106
+ versions .reverse ();
107
+ for (version in versions ) {
108
+ var path = Path .join ([prefsPath , ideaPathName + version ]);
109
+ if (vefiryPreferencesPath (path )) {
110
+ result .push (path );
111
+ }
112
+ }
113
+
114
+ // check versions 19.x and below
115
+ prefsPath = getUserPreferencesPath ();
116
+ ideaPathName = CL .platform .isMac ? " IntelliJIdea" : " .IntelliJIdea" ;
117
+ versions = getVersions (16 , 19 );
118
+
119
+ MakeLog .trace (' Search IntelliJ IDEA 19.x Preferences in: $prefsPath ' );
103
120
104
121
versions .reverse ();
105
122
for (version in versions ) {
@@ -122,14 +139,19 @@ class IdeaContext {
122
139
return Path .join ([path , " options" , " jdk.table.xml" ]);
123
140
}
124
141
142
+ static function getUserAppDataPath (): String {
143
+ var userHome = CL .getUserHome ();
144
+ return CL .platform .isMac ? Path .join ([userHome , " Application Support" ]) : Path .join ([userHome , " AppData" , " Roaming" ]);
145
+ }
146
+
125
147
static function getUserPreferencesPath (): String {
126
148
var userHome = CL .getUserHome ();
127
149
return CL .platform .isMac ? Path .join ([userHome , " Library" , " Preferences" ]) : userHome ;
128
150
}
129
151
130
- static function getVersions (): Array <String > {
152
+ static function getVersions (from : Int , to : Int ): Array <String > {
131
153
var result = [];
132
- for (major in 16 ... 20 ) {
154
+ for (major in from ... to ) {
133
155
result .push (' 20 $major ' );
134
156
for (minor in 1 ... 10 ) {
135
157
result .push (' 20 $major . $minor ' );
0 commit comments