Skip to content
Closed
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
20 changes: 19 additions & 1 deletion apps/desktop/scripts/ensure-electron-runtime.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -101,10 +101,11 @@ function invalidRuntimePaths(electronDir, platformPath) {
].filter((runtimePath) => NodeFS.existsSync(runtimePath) && !isMachO(runtimePath));
}

function runChecked(command, args) {
function runChecked(command, args, env) {
const result = NodeChildProcess.spawnSync(command, args, {
encoding: "utf8",
stdio: "inherit",
env,
});

if (result.status === 0) {
Expand All @@ -129,6 +130,23 @@ function installElectronRuntime(electronDir, version) {
]);
if (hostPlatform === "darwin") {
runChecked("ditto", ["-x", "-k", zipPath, NodePath.join(electronDir, "dist")]);
} else if (hostPlatform === "win32") {
// Windows includes PowerShell, but python3 may only be a Microsoft Store alias.
// Pass paths as data: PowerShell also treats curly apostrophes as string delimiters.
runChecked(
"powershell.exe",
[
"-NoProfile",
"-NonInteractive",
"-Command",
"Expand-Archive -LiteralPath $env:T3_ELECTRON_ARCHIVE -DestinationPath $env:T3_ELECTRON_DESTINATION -Force -ErrorAction Stop",
],
{
...process.env,
T3_ELECTRON_ARCHIVE: zipPath,
T3_ELECTRON_DESTINATION: NodePath.join(electronDir, "dist"),
},
);
} else {
runChecked("python3", [
"-c",
Expand Down
Loading