Skip to content

Commit

Permalink
modify debug notifications
Browse files Browse the repository at this point in the history
  • Loading branch information
idleberg committed Jul 24, 2016
1 parent 3933dfb commit b8bb8c1
Showing 1 changed file with 10 additions and 7 deletions.
17 changes: 10 additions & 7 deletions lib/provider.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,10 @@
import {exec} from 'child_process';
import os from 'os';

const self = '[build-makensis]';
const debug = atom.config.get('build-makensis.debug');
// Package settings
import meta from '../package.json';
const debug = atom.config.get(`${meta.name}.debug`);
const notEligible = `**${meta.name}**: \`makensis\` is not in your PATH`;
let prefix;

export function provideBuilder() {
Expand All @@ -20,20 +22,21 @@ export function provideBuilder() {
isEligible() {
if (os.platform() === 'win32') {
prefix = '/';
return this.findMakensis('where makensis');
return this.findMakensis('where');
} else {
prefix = '-';
return this.findMakensis('which makensis');
return this.findMakensis('which');
}
}

findMakensis(cmd) {
exec(cmd, function (error, stdout, stderr) {
exec(cmd + ' makensis', function (error, stdout, stderr) {
if (error !== null) {
if (debug === true) console.log(self, error);
// No makensis installed
if (debug === true) atom.notifications.addError(notEligible, { detail: error, dismissable: true });
return false;
}
if (debug === true) console.log(self, stdout);
if (debug === true) atom.notifications.addInfo(`**${meta.name}**`, { detail: stdout, dismissable: false });
});

return true;
Expand Down

0 comments on commit b8bb8c1

Please sign in to comment.