From 4661516484e7e4c84384530bd8d192a475387852 Mon Sep 17 00:00:00 2001 From: dylan <> Date: Tue, 26 Mar 2024 20:27:56 -0700 Subject: [PATCH] try explicitly setting PATH --- src/server/api/release.ts | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/server/api/release.ts b/src/server/api/release.ts index e34613d..475f5bb 100644 --- a/src/server/api/release.ts +++ b/src/server/api/release.ts @@ -18,9 +18,9 @@ const url = "/api/release"; const payloadT = Type.Any(); -const repoPath = "./repo"; // path.resolve(__dirname, "..", "..", "..", "repo"); -const picoDirPath = "./pico8"; // path.resolve(__dirname, "..", "..", "..", "pico8"); -const picoBinPath = "./pico8/pico8"; // path.resolve(picoDirPath, "pico8"); +const repoPath = path.resolve(__dirname, "..", "..", "..", "repo"); +const picoDirPath = path.resolve(__dirname, "..", "..", "..", "pico8"); +const picoBinPath = path.resolve(picoDirPath, "pico8"); // const {stdout, } = await execa(picoBinPath, ["/home/dylan/.lexaloffle/pico-8/carts/candles/candles.p8", "-export", path.join(__dirname, "result.js")]); // const {stdout, } = await execa("ls", ["-la", picoDirPath]); @@ -58,7 +58,7 @@ const handler = async ({payload}: FirRouteInput) => { console.log("main exists: ", fs.existsSync(path.join(repoPath, manifest.main))); const {stdout} = await execa("ls", ["-la", picoDirPath], {shell: true}); console.log(stdout); - await execa(picoBinPath, [path.join(repoPath, manifest.main), "-export", path.join(repoPath, "result.js")], {shell: true}); + await execa(picoBinPath, [path.join(repoPath, manifest.main), "-export", path.join(repoPath, "result.js")], {env: {PATH: "/app/pico8"}}); // await execa(picoBinPath, [path.join(repoPath, manifest.main), "-export", path.join(repoPath, "result.png")]); const js = await fs.promises.readFile(path.join(repoPath, "result.js"), "utf8"); // const png = Buffer.from(await fs.promises.readFile(path.join(repoPath, "result.png"))).toString("base64");