Fix one more updater bug on macos
This commit is contained in:
parent
ad85b17c2a
commit
5ee24bf279
1 changed files with 19 additions and 15 deletions
|
@ -6,7 +6,7 @@ import { autoUpdater } from 'electron';
|
||||||
import { writeFile } from 'fs/promises';
|
import { writeFile } from 'fs/promises';
|
||||||
import { join } from 'path';
|
import { join } from 'path';
|
||||||
|
|
||||||
import { Updater, getTempDir } from './common';
|
import { Updater, createTempDir, deleteTempDir } from './common';
|
||||||
import { explodePromise } from '../util/explodePromise';
|
import { explodePromise } from '../util/explodePromise';
|
||||||
import * as Errors from '../types/errors';
|
import * as Errors from '../types/errors';
|
||||||
import { markShouldQuit } from '../../app/window_state';
|
import { markShouldQuit } from '../../app/window_state';
|
||||||
|
@ -64,21 +64,25 @@ export class MacOSUpdater extends Updater {
|
||||||
// See: https://github.com/electron/electron/issues/5020#issuecomment-477636990
|
// See: https://github.com/electron/electron/issues/5020#issuecomment-477636990
|
||||||
const updateUrl = pathToFileURL(filePath).href;
|
const updateUrl = pathToFileURL(filePath).href;
|
||||||
|
|
||||||
const tempDir = await getTempDir();
|
const tempDir = await createTempDir();
|
||||||
const feedPath = join(tempDir, 'feed.json');
|
try {
|
||||||
await writeFile(
|
const feedPath = join(tempDir, 'feed.json');
|
||||||
feedPath,
|
await writeFile(
|
||||||
JSON.stringify({
|
feedPath,
|
||||||
url: updateUrl,
|
JSON.stringify({
|
||||||
})
|
url: updateUrl,
|
||||||
);
|
})
|
||||||
|
);
|
||||||
|
|
||||||
autoUpdater.setFeedURL({
|
autoUpdater.setFeedURL({
|
||||||
url: pathToFileURL(feedPath).href,
|
url: pathToFileURL(feedPath).href,
|
||||||
serverType: 'json',
|
serverType: 'json',
|
||||||
});
|
});
|
||||||
autoUpdater.checkForUpdates();
|
autoUpdater.checkForUpdates();
|
||||||
|
|
||||||
return promise;
|
await promise;
|
||||||
|
} finally {
|
||||||
|
await deleteTempDir(this.logger, tempDir);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue