Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 11 additions & 4 deletions packages/protosprite-cli/src/cli.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import * as aseprite from "@kayahr/aseprite";
import childProcess from "child_process";
import fs from "fs";
import { Jimp } from "jimp";
import os from "os";
import path from "path";
import ProtoSprite, {
ProtoSpriteInstance,
Expand All @@ -20,10 +21,8 @@ import {
ExternalSpriteSheetData,
isEmbeddedSpriteSheetData
} from "../../protosprite-core/dist/src/core/data.js";
import { findAsperiteBinary } from "./util/findAseprite.js";
import { findSteamAsepriteBinary } from "./util/findAseprite.js";
import { genTypeDefinitions } from "./util/genDefinitions.js";
import os from "os";


const program = new Command()
.name("protosprite-cli")
Expand Down Expand Up @@ -113,11 +112,19 @@ class ProtoSpriteCLI {
this.workingDirectory,
`${inputFileParts.name}.png`
);
let asepriteBinPath = findAsperiteBinary();
let asepriteBinPath = findSteamAsepriteBinary();
// Replace spaces in binary path with escapes.
if (os.platform() === "darwin") {
asepriteBinPath = asepriteBinPath?.replaceAll(" ", "\\ ") ?? null;
}
if (asepriteBinPath == null) asepriteBinPath = "aseprite";
try {
childProcess.execSync(`${asepriteBinPath} --version`);
} catch {
throw new Error(
"Cannot find Steam aseprite binary or 'aseprite' on your PATH"
);
}
const asepriteArgs = [
"-b",
"--sheet",
Expand Down
2 changes: 1 addition & 1 deletion packages/protosprite-cli/src/util/findAseprite.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import fs from "fs";
import os from "os";
import path from "path";

export function findAsperiteBinary(): string | null {
export function findSteamAsepriteBinary(): string | null {
const platform = os.platform();

const steamInstallPath = getSteamInstallPath(platform);
Expand Down