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 @@ -115,7 +115,7 @@ export class Swiftly {
115
115
}
116
116
}
117
117
118
- private static isSupported ( ) {
118
+ public static isSupported ( ) {
119
119
return process . platform === "linux" || process . platform === "darwin" ;
120
120
}
121
121
@@ -172,4 +172,22 @@ export class Swiftly {
172
172
) ;
173
173
return JSON . parse ( swiftlyConfigRaw ) ;
174
174
}
175
+
176
+ public static async isInstalled ( ) {
177
+
178
+ if ( ! Swiftly . isSupported ( ) ) {
179
+ return false ;
180
+ }
181
+
182
+ try {
183
+ await Swiftly . version ( ) ;
184
+ return true ;
185
+ } catch ( error ) {
186
+ if ( error instanceof ExecFileError && 'code' in error && error . code === "ENOENT" ) {
187
+ return false ;
188
+ }
189
+ throw error ;
190
+ }
191
+
192
+ }
175
193
}
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