Skip to content
Source
Sign inSign up
pingdotgg/t3code
Open History to see the last commit

@ff-labs__fff-node@0.9.4.patch

39 lines1.5 KB

1diff --git a/dist/src/binary.js b/dist/src/binary.js
2index ee181aef5007e4bf34a49479c089ca30f73a320b..327e2c55c83cc4c50d396a3109190ef10af75ca7 100644
3--- a/dist/src/binary.js
4+++ b/dist/src/binary.js
5@@ -7,7 +7,7 @@
6 */
7 import { existsSync, readFileSync } from "node:fs";
8 import { createRequire } from "node:module";
9-import { dirname, join } from "node:path";
10+import { dirname, join, sep } from "node:path";
11 import { fileURLToPath } from "node:url";
12 import { getLibFilename, getNpmPackageName } from "./platform.js";
13 /**
14@@ -46,6 +46,16 @@ function getPackageDir() {
15 // Fallback: assume we're one level deep in src/
16 return dirname(currentDir);
17 }
18+function resolveUnpackedAsarPath(binaryPath) {
19+ const pathSegments = binaryPath.split(sep);
20+ const asarIndex = pathSegments.findLastIndex((segment) => segment.endsWith(".asar"));
21+ if (asarIndex === -1) {
22+ return binaryPath;
23+ }
24+ pathSegments[asarIndex] = `${pathSegments[asarIndex]}.unpacked`;
25+ const unpackedPath = pathSegments.join(sep);
26+ return existsSync(unpackedPath) ? unpackedPath : binaryPath;
27+}
28 /**
29 * Check if the binary exists in any known location
30 */
31@@ -69,7 +77,7 @@ function resolveFromNpmPackage() {
32 const packageDir = dirname(packageJsonPath);
33 const binaryPath = join(packageDir, getLibFilename());
34 if (existsSync(binaryPath)) {
35- return binaryPath;
36+ return resolveUnpackedAsarPath(binaryPath);
37 }
38 }
39 catch {