Skip to content

Commit

Permalink
Merge pull request #246 from set-soft/fix-checkToolchain
Browse files Browse the repository at this point in the history
The checkToolchain function must run apio even when toolchain.disable…
  • Loading branch information
Jesus89 authored Jul 19, 2018
2 parents d3d7ba3 + 8290ea1 commit 3233162
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 3233162

Please sign in to comment.