chore: Fix build failing on non-windows platforms

Signed-off-by: Sebastian Malton <sebastian@malton.name>
This commit is contained in:
Sebastian Malton committed 2023-05-09 12:50:45 -04:00
1 parent c4d56ef1a7
commit 786e0e8ac9
1 file changed
+6 -1
+6 -1
View File
@@ -10,6 +10,7 @@ import path from "path";
import sharp from "sharp";
import arg from "arg";
import assert from "assert";
import { platform } from "process";
const options = arg({
"--input": String,
@@ -45,7 +46,11 @@ const joinWithInitCwd = (relativePath: string): string => {
const resolve = async (input: string) => {
const filePath = await import.meta.resolve?.(input);
return filePath?.replace("file:///", "");
if (platform === "win32") {
return filePath?.replace("file:///", "");
} else {
return filePath?.replace("file://", "");
}
}
const size = options["--output-size"] ?? 16;