Consolidate afterPack scripts into one file

This commit is contained in:
CakeLancelot 2023-02-09 04:39:21 -06:00
parent 101de9d68b
commit 5da0da1981
4 changed files with 29 additions and 33 deletions

View File

@ -1,19 +0,0 @@
const fs = require('fs');
const file = './dist/win-ia32-unpacked/OpenFusionClient.exe'
exports.default = async function() {
fs.open(file, "r+", (err, fd) => {
if(!err) {
fs.write(
fd, new Uint8Array([0x22]), 0, 1, 0x166,
(err) => {
if(err) {
throw err;
}
}
);
} else {
throw err;
}
});
}

28
build/afterpack.js Normal file
View File

@ -0,0 +1,28 @@
const fs = require('fs');
const dir = './dist/win-ia32-unpacked/resources/default_app'
const exefile = './dist/win-ia32-unpacked/OpenFusionClient.exe'
exports.default = function() {
// remove leftover files from default electron app
fs.rm(dir, { recursive: true }, (err) => {
if (err) {
throw err;
}
});
// patch executable for large address awareness
fs.open(exefile, "r+", (err, fd) => {
if(!err) {
fs.write(
fd, new Uint8Array([0x22]), 0, 1, 0x166,
(err) => {
if(err) {
throw err;
}
fs.closeSync(fd);
}
);
} else {
throw err;
}
});
}

View File

@ -1,10 +0,0 @@
const fs = require('fs');
const dir = './dist/win-ia32-unpacked/resources/default_app'
exports.default = async function() {
fs.rm(dir, { recursive: true }, (err) => {
if (err) {
throw err;
}
});
}

View File

@ -67,10 +67,7 @@
"to": "utils" "to": "utils"
} }
], ],
"afterPack": [ "afterPack": "./build/afterpack.js"
"./build/4gb-patch.js",
"./build/delete-default-app.js"
]
}, },
"dependencies": { "dependencies": {
"fs-extra": "^0.30.0" "fs-extra": "^0.30.0"