Skip to content

Commit

Permalink
The checkToolchain function must run apio even when toolchain.disable…
Browse files Browse the repository at this point in the history
…d is true
  • Loading branch information
set-soft committed Jun 13, 2018
1 parent 8102eed commit 8290ea1
Showing 1 changed file with 30 additions and 32 deletions.
62 changes: 30 additions & 32 deletions app/scripts/services/tools.js
Original file line number Diff line number Diff line change
Expand Up @@ -232,44 +232,42 @@ angular.module('icestudio')
function checkToolchain(callback) {
var apio = utils.getApioExecutable();
toolchain.disabled = utils.toolchainDisabled;
if (!toolchain.disabled) {
nodeChildProcess.exec([apio, '--version'].join(' '), function(error, stdout/*, stderr*/) {
if (error) {
toolchain.apio = '';
toolchain.installed = false;
// Apio not installed
toolchainNotInstalledAlert(gettextCatalog.getString('Toolchain not installed'));
if (callback) {
callback();
}
nodeChildProcess.exec([apio, '--version'].join(' '), function(error, stdout/*, stderr*/) {
if (error) {
toolchain.apio = '';
toolchain.installed = false;
// Apio not installed
toolchainNotInstalledAlert(gettextCatalog.getString('Toolchain not installed'));
if (callback) {
callback();
}
else {
toolchain.apio = stdout.match(/apio,\sversion\s(.+)/i)[1];
toolchain.installed = toolchain.apio >= _package.apio.min &&
toolchain.apio < _package.apio.max;
if (toolchain.installed) {
nodeChildProcess.exec([apio, 'clean', '-p', common.SAMPLE_DIR].join(' '), function(error/*, stdout, stderr*/) {
toolchain.installed = !error;
if (error) {
toolchain.apio = '';
// Toolchain not properly installed
toolchainNotInstalledAlert(gettextCatalog.getString('Toolchain not installed'));
}
if (callback) {
callback();
}
});
}
else {
// An old version is installed
toolchainNotInstalledAlert(gettextCatalog.getString('Toolchain version does not match'));
}
else {
toolchain.apio = stdout.match(/apio,\sversion\s(.+)/i)[1];
toolchain.installed = toolchain.apio >= _package.apio.min &&
toolchain.apio < _package.apio.max;
if (toolchain.installed) {
nodeChildProcess.exec([apio, 'clean', '-p', common.SAMPLE_DIR].join(' '), function(error/*, stdout, stderr*/) {
toolchain.installed = !error;
if (error) {
toolchain.apio = '';
// Toolchain not properly installed
toolchainNotInstalledAlert(gettextCatalog.getString('Toolchain not installed'));
}
if (callback) {
callback();
}
});
}
else {
// An old version is installed
toolchainNotInstalledAlert(gettextCatalog.getString('Toolchain version does not match'));
if (callback) {
callback();
}
}
});
}
}
});

function toolchainNotInstalledAlert(message) {
if (resultAlert) {
Expand Down

0 comments on commit 8290ea1

Please sign in to comment.