fraim 2.0.318 → 2.0.319
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -138,6 +138,16 @@ function runtimeFromEnv(env = process.env) {
|
|
|
138
138
|
? { executable: env.FRAIM_PACKAGED_CLI_EXECUTABLE, script: env.FRAIM_PACKAGED_CLI_SCRIPT }
|
|
139
139
|
: null;
|
|
140
140
|
}
|
|
141
|
+
// Regular Node.js (and ELECTRON_RUN_AS_NODE) cannot see inside Electron's
|
|
142
|
+
// .asar archives. For paths like …/app.asar/node_modules/…, verify the
|
|
143
|
+
// archive file itself rather than the internal entry.
|
|
144
|
+
function existsOrAsarExists(filePath) {
|
|
145
|
+
const normalized = filePath.replace(/\\/g, '/');
|
|
146
|
+
const asarSep = normalized.indexOf('.asar/');
|
|
147
|
+
if (asarSep === -1)
|
|
148
|
+
return fs_1.default.existsSync(filePath);
|
|
149
|
+
return fs_1.default.existsSync(filePath.slice(0, asarSep + '.asar'.length));
|
|
150
|
+
}
|
|
141
151
|
function getPackagedFraimRuntime(env = process.env) {
|
|
142
152
|
const envRuntime = runtimeFromEnv(env);
|
|
143
153
|
if (envRuntime)
|
|
@@ -146,7 +156,7 @@ function getPackagedFraimRuntime(env = process.env) {
|
|
|
146
156
|
const raw = JSON.parse(fs_1.default.readFileSync(getPackagedFraimRuntimePath(), 'utf8'));
|
|
147
157
|
if (!raw.executable || !raw.script)
|
|
148
158
|
return null;
|
|
149
|
-
if (!fs_1.default.existsSync(raw.executable) || !
|
|
159
|
+
if (!fs_1.default.existsSync(raw.executable) || !existsOrAsarExists(raw.script))
|
|
150
160
|
return null;
|
|
151
161
|
return { executable: raw.executable, script: raw.script };
|
|
152
162
|
}
|