Skip to content

Commit

Permalink
updater/win32: fix crashing linux
Browse files Browse the repository at this point in the history
  • Loading branch information
CanadaHonk committed Nov 22, 2023
1 parent d12d826 commit 785b518
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions src/updater/updater.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,7 @@ const TASK_STATE_WORKING = 'Working';
// discord made breaking changes without any api versioning wow!!
// so we have to read the node module to determine the version
let updaterVersion = 1;

const updaterPath = paths.getExeDir() + '/updater.node';
const updaterContents = require('fs').readFileSync(updaterPath, 'utf8');
if (updaterContents.includes('Determined this is an architecture transition')) updaterVersion = 2;
log('Updater', 'Determined native module version', updaterVersion);

class Updater extends require('events').EventEmitter {
constructor(options) {
Expand Down Expand Up @@ -364,6 +360,11 @@ module.exports = {
const root_path = paths.getInstallPath();
if (root_path == null) return false;

const updaterContents = require('fs').readFileSync(updaterPath, 'utf8');
if (updaterContents.includes('Determined this is an architecture transition')) updaterVersion = 2;

log('Updater', 'Determined native module version', updaterVersion);

instance = new Updater({
release_channel: buildInfo.releaseChannel,
platform: process.platform === 'win32' ? 'win' : 'osx',
Expand Down

0 comments on commit 785b518

Please sign in to comment.