aboutsummaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
authorVen <vendicated@riseup.net>2022-10-22 02:36:49 +0200
committerGitHub <noreply@github.com>2022-10-22 02:36:49 +0200
commit23d4cae1230bd60da2f0497ecac9d4a32a326f5b (patch)
tree5a8ea86af37f9034d6ac567e509a1defdc5b46a3 /scripts
parent0da02e009c59a12c365622dac60e9b4d87ae8b8a (diff)
downloadVencord-23d4cae1230bd60da2f0497ecac9d4a32a326f5b.tar.gz
Vencord-23d4cae1230bd60da2f0497ecac9d4a32a326f5b.tar.bz2
Vencord-23d4cae1230bd60da2f0497ecac9d4a32a326f5b.zip
Installer: add custom path option (#77)
Diffstat (limited to 'scripts')
-rw-r--r--scripts/patcher/common.js38
1 files changed, 32 insertions, 6 deletions
diff --git a/scripts/patcher/common.js b/scripts/patcher/common.js
index 840c842..3217d5c 100644
--- a/scripts/patcher/common.js
+++ b/scripts/patcher/common.js
@@ -95,13 +95,12 @@ async function getMenuItem(installations) {
info,
}));
- if (menuItems.length === 0) {
- console.log("No Discord installations found.");
- process.exit(1);
- }
-
const result = await menu(
- [...menuItems, { title: "Exit without patching", exit: true }],
+ [
+ ...menuItems,
+ { title: "Specify custom path", info: "custom" },
+ { title: "Exit without patching", exit: true }
+ ],
{
header: "Select a Discord installation to patch:",
border: true,
@@ -116,6 +115,33 @@ async function getMenuItem(installations) {
process.exit(0);
}
+ if (result.info === "custom") {
+ const customPath = await question("Please enter the path: ");
+ if (!customPath || !fs.existsSync(customPath)) {
+ console.log("No such Path or not specifed.");
+ process.exit();
+ }
+
+ const resourceDir = path.join(customPath, "resources");
+ if (!fs.existsSync(path.join(resourceDir, "app.asar"))) {
+ console.log("Unsupported Install. resources/app.asar not found");
+ process.exit();
+ }
+
+ const appDir = path.join(resourceDir, "app");
+ result.info = {
+ branch: "unknown",
+ patched: fs.existsSync(appDir),
+ location: customPath,
+ versions: [{
+ path: appDir,
+ name: null
+ }],
+ arch: process.platform === "linux" ? "linux" : "win32",
+ isFlatpak: false,
+ };
+ }
+
if (result.info.patched) {
const answer = await question(
"This installation has already been modified. Overwrite? [Y/n]: "