Skip to content

Commit

Permalink
git updater: Fix macOS (Vendicated#391)
Browse files Browse the repository at this point in the history
Co-authored-by: Ven <[email protected]>
  • Loading branch information
domi-btnr and Vendicated authored Jan 13, 2023
1 parent 32cdb63 commit 6329499
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ node_modules
vencord_installer

.idea
.DS_Store

yarn.lock
package-lock.json
Expand Down
8 changes: 5 additions & 3 deletions src/ipcMain/updater/git.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@ const execFile = promisify(cpExecFile);

const isFlatpak = Boolean(process.env.FLATPAK_ID?.includes("discordapp") || process.env.FLATPAK_ID?.includes("Discord"));

if (process.platform === "darwin") process.env.PATH = `/usr/local/bin:${process.env.PATH}`;

function git(...args: string[]) {
const opts = { cwd: VENCORD_SRC_DIR };

Expand Down Expand Up @@ -66,10 +68,10 @@ async function pull() {
async function build() {
const opts = { cwd: VENCORD_SRC_DIR };

let res;
const command = isFlatpak ? "flatpak-spawn" : "node";
const args = isFlatpak ? ["--host", "node", "scripts/build/build.mjs"] : ["scripts/build/build.mjs"];

if (isFlatpak) res = await execFile("flatpak-spawn", ["--host", "node", "scripts/build/build.mjs"], opts);
else res = await execFile("node", ["scripts/build/build.mjs"], opts);
const res = await execFile(command, args, opts);

return !res.stderr.includes("Build failed");
}
Expand Down

0 comments on commit 6329499

Please sign in to comment.