File tree Expand file tree Collapse file tree 2 files changed +20
-2
lines changed Expand file tree Collapse file tree 2 files changed +20
-2
lines changed Original file line number Diff line number Diff line change @@ -133,7 +133,7 @@ export class Swiftly {
133
133
}
134
134
}
135
135
136
- private static isSupported ( ) {
136
+ public static isSupported ( ) {
137
137
return process . platform === "linux" || process . platform === "darwin" ;
138
138
}
139
139
@@ -194,4 +194,22 @@ export class Swiftly {
194
194
) ;
195
195
return JSON . parse ( swiftlyConfigRaw ) ;
196
196
}
197
+
198
+ public static async isInstalled ( ) {
199
+
200
+ if ( ! Swiftly . isSupported ( ) ) {
201
+ return false ;
202
+ }
203
+
204
+ try {
205
+ await Swiftly . version ( ) ;
206
+ return true ;
207
+ } catch ( error ) {
208
+ if ( error instanceof ExecFileError && 'code' in error && error . code === "ENOENT" ) {
209
+ return false ;
210
+ }
211
+ throw error ;
212
+ }
213
+
214
+ }
197
215
}
Original file line number Diff line number Diff line change @@ -224,7 +224,7 @@ async function getQuickPickItems(
224
224
}
225
225
// Various actions that the user can perform (e.g. to install new toolchains)
226
226
const actionItems : ActionItem [ ] = [ ] ;
227
- if ( process . platform === "linux" || process . platform === "darwin" ) {
227
+ if ( Swiftly . isSupported ( ) && ! ( await Swiftly . isInstalled ( ) ) ) {
228
228
const platformName = process . platform === "linux" ? "Linux" : "macOS" ;
229
229
actionItems . push ( {
230
230
type : "action" ,
You can’t perform that action at this time.
0 commit comments