From fce757c390fbd2ad29a554b113e38ee25bb25473 Mon Sep 17 00:00:00 2001 From: Ryan Adolf Date: Sun, 31 Dec 2023 21:40:24 -0800 Subject: [PATCH] Try setting paths correctly --- src/model_gen/download-openscad.ts | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/src/model_gen/download-openscad.ts b/src/model_gen/download-openscad.ts index 837a531..cfefb3c 100644 --- a/src/model_gen/download-openscad.ts +++ b/src/model_gen/download-openscad.ts @@ -1,5 +1,5 @@ import { execFileSync, spawnSync } from 'child_process' -import { accessSync, constants, createWriteStream, existsSync, linkSync, lstatSync, readdirSync, rmSync } from 'fs' +import { accessSync, constants, createWriteStream, existsSync, linkSync, lstatSync, readdirSync, rmSync, writeFileSync } from 'fs' import { join } from 'path' import * as readline from 'readline/promises' import { Readable } from 'stream' @@ -133,8 +133,14 @@ async function main() { encoding: 'utf-8', cwd: targetDir, })) - rmSync(destination) - linkOpenSCAD(join(targetDir, 'squashfs-root/AppRun')) + writeFileSync( + destination, + `#!/bin/sh +SELF=$(readlink -f "$0") +HERE=\${SELF%/*} +exec $HERE/squashfs-root/AppRun "$@" +`, + ) } }