Files
libloot/scripts/create_ico.js
T
Oliver Hamlet c80d1eb5f7 Remove ICO file from repository
Instead generate it as a pre-build step. It can't be generated as part
of the CMake build process because MSVC changes the PATH so that another
convert.exe conflicts with imagemagick's.
2016-12-01 19:03:12 +00:00

32 lines
748 B
JavaScript

const childProcess = require('child_process');
const fs = require('fs-extra');
const path = require('path');
const svgPath = path.join('resources', 'icon.svg');
const buildDirectory = path.join('build', 'icon');
const outputPath = path.join(buildDirectory, 'icon.ico');
const sizes = [16, 20, 24, 30, 32, 36, 40, 48, 60, 64, 72, 80, 96, 128, 256];
fs.mkdirsSync(buildDirectory);
const convertArgs = [];
sizes.forEach((size) => {
const pngFile = path.join(buildDirectory, `icon-${size}.png`);
convertArgs.push(pngFile);
childProcess.execFileSync('inkscape', [
'-z',
'-e',
pngFile,
'-w',
size,
'-h',
size,
svgPath,
]);
});
convertArgs.push(outputPath);
childProcess.execFileSync('convert', convertArgs);