mirror of
https://github.com/smogon/sprites.git
synced 2026-09-08 10:05:45 -05:00
deflopt: execute wine if platform not win32
This commit is contained in:
@@ -48,7 +48,7 @@ function compresspng(opts)
|
||||
cmds += rep{"advpng -q ${opts} ${output}", opts=advpng, output=output}
|
||||
end
|
||||
if deflopt then
|
||||
cmds += rep{"node ${root}/tools/deflopt --wine ${output}",
|
||||
cmds += rep{"node ${root}/tools/deflopt ${output}",
|
||||
root=ROOTDIR,
|
||||
output=output}
|
||||
end
|
||||
|
||||
@@ -32,18 +32,18 @@ function parse(re : RegExp, output : string) {
|
||||
|
||||
const DEFLOPT_EXE = `${root}/vendor/DeflOpt.exe`;
|
||||
|
||||
export function deflopt({file, wine}: {file : string, wine: boolean}) {
|
||||
export function deflopt(file : string) {
|
||||
file = file.replace(/\//g, "\\");
|
||||
|
||||
let cmd, args;
|
||||
if (wine) {
|
||||
if (process.platform === 'win32') {
|
||||
cmd = DEFLOPT_EXE;
|
||||
args = [file];
|
||||
} else {
|
||||
cmd = "wine";
|
||||
// DeflOpt doesn't like absolute paths, it thinks they are Windows-style
|
||||
// command line switches.
|
||||
args = [DEFLOPT_EXE, file];
|
||||
} else {
|
||||
cmd = DEFLOPT_EXE;
|
||||
args = [file];
|
||||
}
|
||||
|
||||
const output = cp.execFileSync(cmd, args, {encoding: 'utf8'});
|
||||
|
||||
@@ -4,10 +4,9 @@ import program from 'commander';
|
||||
import {deflopt} from './deflopt.js';
|
||||
|
||||
program
|
||||
.option('--wine', 'Run executable with Wine')
|
||||
.arguments('<file>')
|
||||
.action((file : string, {wine} : {wine?: boolean}) => {
|
||||
const {processed, rewritten} = deflopt({file, wine: !!wine});
|
||||
.action((file : string) => {
|
||||
const {processed, rewritten} = deflopt(file);
|
||||
if (processed !== 1) {
|
||||
console.error(`Didn't process any files.`);
|
||||
process.exit(1);
|
||||
|
||||
Reference in New Issue
Block a user