Check if unix before doing singleIco

This commit is contained in:
Jia Hao 2016-03-10 13:09:10 +08:00
parent 79c7767bb0
commit dab00a80e6
2 changed files with 9 additions and 1 deletions

View File

@ -30,6 +30,7 @@ function iconBuild(options, callback) {
if (options.platform === 'win32') {
if (!iconIsIco(options.icon)) {
console.warn('Icon should be an .ico to package for Windows');
returnCallback();
return;
}
@ -40,7 +41,7 @@ function iconBuild(options, callback) {
returnCallback();
})
.catch(error => {
console.warn('Skipping process to make .ico icon contain only a single image: ', error);
console.warn('Skipping process to make .ico icon contain only a single image:', error);
returnCallback();
});
return;

View File

@ -1,6 +1,8 @@
import shell from 'shelljs';
import path from 'path';
import tmp from 'tmp';
import helpers from './helpers';
const {isWindows} = helpers;
tmp.setGracefulCleanup();
@ -13,6 +15,11 @@ const EXTRACT_ICO_PATH = path.join(__dirname, '../..', 'bin/singleIco');
*/
function singleIco(icoSrc, dest) {
return new Promise((resolve, reject) => {
if (isWindows()) {
reject('OSX or Linux is required');
return;
}
shell.exec(`${EXTRACT_ICO_PATH} ${icoSrc} ${dest}`, {silent: true}, (exitCode, stdOut, stdError) => {
if (stdOut.includes('icon.iconset:error') || exitCode) {
if (exitCode) {