Skip to content
Closed
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
8 changes: 5 additions & 3 deletions scripts/build_dev.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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<void> {
Expand Down Expand Up @@ -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`);
16 changes: 7 additions & 9 deletions scripts/run_dev.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Expand All @@ -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");
Expand Down