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 @@ -158,7 +158,7 @@ export class Swiftly {
158
158
}
159
159
}
160
160
161
- private static isSupported ( ) {
161
+ public static isSupported ( ) {
162
162
return process . platform === "linux" || process . platform === "darwin" ;
163
163
}
164
164
@@ -245,4 +245,22 @@ export class Swiftly {
245
245
) ;
246
246
return JSON . parse ( swiftlyConfigRaw ) ;
247
247
}
248
+
249
+ public static async isInstalled ( ) {
250
+
251
+ if ( ! Swiftly . isSupported ( ) ) {
252
+ return false ;
253
+ }
254
+
255
+ try {
256
+ await Swiftly . version ( ) ;
257
+ return true ;
258
+ } catch ( error ) {
259
+ if ( error instanceof ExecFileError && 'code' in error && error . code === "ENOENT" ) {
260
+ return false ;
261
+ }
262
+ throw error ;
263
+ }
264
+
265
+ }
248
266
}
Original file line number Diff line number Diff line change @@ -257,7 +257,7 @@ async function getQuickPickItems(
257
257
}
258
258
// Various actions that the user can perform (e.g. to install new toolchains)
259
259
const actionItems : ActionItem [ ] = [ ] ;
260
- if ( process . platform === "linux" || process . platform === "darwin" ) {
260
+ if ( Swiftly . isSupported ( ) && ! ( await Swiftly . isInstalled ( ) ) ) {
261
261
const platformName = process . platform === "linux" ? "Linux" : "macOS" ;
262
262
actionItems . push ( {
263
263
type : "action" ,
You can’t perform that action at this time.
0 commit comments