Skip to content

Commit d2b11cf

Browse files
committed
I do not like paths
1 parent c4aa102 commit d2b11cf

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

build/main.ts

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ import {
1313
import { string } from "jsr:@optique/[email protected]/valueparser";
1414
import { run } from "jsr:@optique/[email protected]";
1515
import { bold, green, red } from "jsr:@std/fmt@1/colors";
16+
import * as path from "jsr:@std/path@1";
1617
import { build, buildLib, check } from "./build.ts";
1718
import { setupDeps } from "./deps.ts";
1819
import { install } from "./install.ts";
@@ -107,9 +108,7 @@ const parser = or(
107108
);
108109

109110
const VERSION = (() => {
110-
const p = `${
111-
import.meta.filename?.split("/").slice(0, -1).join("/")
112-
}/../Cargo.toml`;
111+
const p = path.join(import.meta.dirname ?? "", "..", "Cargo.toml");
113112
const data = new TextDecoder().decode(Deno.readFileSync(p));
114113
const r = /version = "([^"]+)"/.exec(data);
115114
return r ? r[1] : "unknown";

build/util.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import { cyan, dim } from "jsr:@std/fmt@1/colors";
2+
import * as path from "jsr:@std/path@1";
23

34
// Build tool to use for compilation
45
export enum BuildTool {
@@ -46,7 +47,7 @@ export function getEnvVars(target?: string): Record<string, string> {
4647
LZMA_API_STATIC: "1",
4748
LIBTORCH_BYPASS_VERSION_CHECK: "1",
4849
LIBTORCH: Deno.realPathSync(
49-
`${import.meta.dirname}/../.x/sysroot/${actualTarget}`,
50+
path.join(import.meta.dirname ?? "", "..", ".x", "sysroot", actualTarget),
5051
),
5152
LIBTORCH_STATIC: "1",
5253
};

0 commit comments

Comments
 (0)