[RetainAsar] Initial Add
This commit is contained in:
parent
c90c4fe491
commit
d289cec12e
2 changed files with 31 additions and 2 deletions
|
@ -1,6 +1,11 @@
|
||||||
// Stub for now at least
|
// Stub for now at least, also retaining OpenAsar
|
||||||
|
|
||||||
|
const retainAsar = require('./retainAsar');
|
||||||
|
|
||||||
exports.install = (callback) => { callback(); };
|
exports.install = (callback) => { callback(); };
|
||||||
exports.update = (callback) => { callback(); };
|
exports.update = (callback) => {
|
||||||
|
retainAsar();
|
||||||
|
callback();
|
||||||
|
};
|
||||||
exports.uninstall = (callback) => { callback(); };
|
exports.uninstall = (callback) => { callback(); };
|
||||||
exports.isInstalled = (callback) => { callback(true); }; // Stub to true or false?
|
exports.isInstalled = (callback) => { callback(true); }; // Stub to true or false?
|
24
src/autoStart/retainAsar.js
Normal file
24
src/autoStart/retainAsar.js
Normal file
|
@ -0,0 +1,24 @@
|
||||||
|
const paths = require('../paths');
|
||||||
|
const { join } = require('path');
|
||||||
|
const { copyFileSync, readdirSync } = require('original-fs'); // Use original-fs, not Electron's modified fs
|
||||||
|
|
||||||
|
module.exports = () => {
|
||||||
|
log('RetainAsar', 'Detected possible host update, retaining OpenAsar...');
|
||||||
|
|
||||||
|
const currentAsarPath = join(require.main.filename, '..');
|
||||||
|
|
||||||
|
const installDir = paths.getInstallPath();
|
||||||
|
|
||||||
|
const nextAppDir = readdirSync(installDir).reverse().find((x) => x.startsWith('app-1'));
|
||||||
|
const nextAsarPath = join(installDir, nextAppDir, 'resources', 'app.asar');
|
||||||
|
|
||||||
|
log('RetainAsar', `Paths:
|
||||||
|
Install Dir: ${installDir}
|
||||||
|
Next App Dir: ${nextAppDir}
|
||||||
|
Current Asar: ${currentAsarPath}
|
||||||
|
Next Asar: ${nextAsarPath}`);
|
||||||
|
|
||||||
|
copyFileSync(currentAsarPath, nextAsarPath);
|
||||||
|
|
||||||
|
log('RetainAsar', 'Completed');
|
||||||
|
};
|
Loading…
Add table
Add a link
Reference in a new issue