From 730f1c4a84d8b5b86203315bb2f7bd86ce478eee Mon Sep 17 00:00:00 2001 From: Nathan Flurry Date: Mon, 7 Oct 2024 08:32:36 -0700 Subject: [PATCH] fix: fix build_dev.ts & run_dev.ts on windows --- scripts/build_dev.ts | 8 +++++--- scripts/run_dev.ts | 16 +++++++--------- 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/scripts/build_dev.ts b/scripts/build_dev.ts index e52c9cf..1c61221 100755 --- a/scripts/build_dev.ts +++ b/scripts/build_dev.ts @@ -19,6 +19,7 @@ const target = { platform === "darwin" ? "apple-darwin" : "unknown-linux-gnu" }`, + prefix: platform === "windows" ? "" : "lib", }; async function copyFile(src: string, dest: string): Promise { @@ -51,12 +52,13 @@ const ffiSrc = join( toolchainRepoPath, "target", "debug", - `librivet_toolchain_ffi.${target.ext}`, + `${target.prefix}rivet_toolchain_ffi.${target.ext}`, ); const ffiDest = join( assetsPath, - `librivet_toolchain_ffi_${target.os}_${target.arch}.${target.ext}`, + `${target.prefix}rivet_toolchain_ffi_${target.os}_${target.arch}.${target.ext}`, ); +console.log(`Copying ${ffiSrc} -> ${ffiDest}`); await copyFile(ffiSrc, ffiDest); -console.log(`Copied ${ffiSrc} -> ${ffiDest}`); +console.log(`Finished building`); diff --git a/scripts/run_dev.ts b/scripts/run_dev.ts index 26b2353..179f31b 100755 --- a/scripts/run_dev.ts +++ b/scripts/run_dev.ts @@ -3,21 +3,19 @@ import "./build_dev.ts"; import { glob } from "npm:glob"; -import { dirname, fromFileUrl, join } from "jsr:@std/path"; +import { dirname, fromFileUrl, join, normalize } from "jsr:@std/path"; const __dirname = dirname(fromFileUrl(import.meta.url)); -const projectDir = `${__dirname}/..`; +const projectDir = normalize(`${__dirname}/..`); // Determine the Unity executable path based on the platform let unityPath: string; switch (Deno.build.os) { case "windows": - unityPath = - "C:\\Program Files\\Unity\\Hub\\Editor\\*\\Editor\\Unity.exe"; + unityPath = "C:/Program Files/Unity/Hub/Editor/*/Editor/Unity.exe"; break; case "darwin": - unityPath = - "/Applications/Unity/Hub/Editor/*/Unity.app/Contents/MacOS/Unity"; + unityPath = "/Applications/Unity/Hub/Editor/*/Unity.app/Contents/MacOS/Unity"; break; case "linux": unityPath = "/opt/unity/editor/*/Editor/Unity"; @@ -27,12 +25,12 @@ switch (Deno.build.os) { } // Find the latest Unity version installed -const unityVersions = await glob(unityPath); +const unityVersions = await glob(unityPath, { windowsPathsNoEscape: true }); if (unityVersions.length === 0) { throw new Error("No Unity installation found"); } -unityVersions.sort(); -const latestUnity = unityVersions[unityVersions.length - 1]; +unityVersions.sort((a, b) => b.localeCompare(a, undefined, { numeric: true, sensitivity: 'base' })); +const latestUnity = unityVersions[0]; // Delete the multiple project file lock const lockFilePath = join(projectDir, "Temp", "UnityLockfile");