Skip to content

Commit 1cb12b1

Browse files
authored
Merge pull request #7 from zapta/main
Minor tweaks.
2 parents 0af6e68 + adefc55 commit 1cb12b1

3 files changed

Lines changed: 22 additions & 10 deletions

File tree

apio-log.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ function init(context) {
1515
return; // already initialized
1616
}
1717

18-
outputChannel = vscode.window.createOutputChannel("Apio");
18+
outputChannel = vscode.window.createOutputChannel("Apio Extension");
1919
context.subscriptions.push(outputChannel);
2020
}
2121

apio-platforms.js

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,15 @@
1818

1919
const process = require("process");
2020

21+
// The set of platforms ids that are supported by this extension.
22+
// Generally speaking we support platforms for which we build an
23+
// (pyinstaller) Apio release bundle.
24+
const SUPPORTED_PLATFORMS_IDS = [
25+
"darwin-arm64",
26+
"linux-x86-64",
27+
"windows-amd64",
28+
];
29+
2130
/**
2231
* Cached platform identifier.
2332
* Set on first successful call to getPlatformId().
@@ -84,6 +93,7 @@ function isLinux() {
8493
/* Module exports */
8594
/* ------------------------------------------------------------------ */
8695
module.exports = {
96+
SUPPORTED_PLATFORMS_IDS,
8797
getPlatformId,
8898
isWindows,
8999
isDarwin,

extension.js

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ function traverseAndRegisterCommands(context, preCmds, nodes) {
110110
}
111111
}
112112

113-
// Recursively traverse the tree nodes and register the Apio
113+
// Recursively traverse the tree nodes and register the Apio
114114
// buttons.
115115
function traverseAndRegisterTreeButtons(context, nodesList) {
116116
for (const node of nodesList) {
@@ -174,8 +174,6 @@ class ApioTreeProvider {
174174
}
175175
}
176176

177-
178-
179177
// A function to execute an action. Action can have commands anr/or url.
180178
function launchAction(cmds, url, apioBinaryPath) {
181179
// return () => {
@@ -313,11 +311,17 @@ function activate(context) {
313311
// Init Apio log output channel.
314312
apioLog.init(context);
315313

316-
// outputChannel = vscode.window.createOutputChannel("Apio");
317-
// context.subscriptions.push(outputChannel);
318-
319314
apioLog.msg("activate() started.");
320315

316+
// Check that we are on a supported platforms.
317+
const platformId = platforms.getPlatformId();
318+
if (!platforms.SUPPORTED_PLATFORMS_IDS.includes(platformId)) {
319+
apioLog.msg(
320+
`Platform id ${platformId} is not supported by this extension.`
321+
);
322+
return;
323+
}
324+
321325
// Determine the workspace folder, do nothing if none.
322326
const ws = vscode.workspace.workspaceFolders?.[0];
323327
if (!ws) {
@@ -338,12 +342,10 @@ function activate(context) {
338342
apioLog.msg(`apio.ini file not found at ${apioIniPath}`);
339343
return;
340344
}
341-
apioLog.msg("apio.ini found");
345+
apioLog.msg("apio.ini found, activating the extension");
342346

343347
// Here we are committed to activate the extension.
344348

345-
// apioLog.msg(`Platform id: ${platforms.getPlatformId()}`)
346-
347349
apioLog.msg(`Platform id: ${platforms.getPlatformId()}`);
348350
apioLog.msg(`isWindows: ${platforms.isWindows()}`);
349351
apioLog.msg(`isLinux: ${platforms.isLinux()}`);

0 commit comments

Comments
 (0)