Installer: add custom path option (#77)
This commit is contained in:
parent
0da02e009c
commit
23d4cae123
|
@ -95,13 +95,12 @@ async function getMenuItem(installations) {
|
||||||
info,
|
info,
|
||||||
}));
|
}));
|
||||||
|
|
||||||
if (menuItems.length === 0) {
|
|
||||||
console.log("No Discord installations found.");
|
|
||||||
process.exit(1);
|
|
||||||
}
|
|
||||||
|
|
||||||
const result = await menu(
|
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:",
|
header: "Select a Discord installation to patch:",
|
||||||
border: true,
|
border: true,
|
||||||
|
@ -116,6 +115,33 @@ async function getMenuItem(installations) {
|
||||||
process.exit(0);
|
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) {
|
if (result.info.patched) {
|
||||||
const answer = await question(
|
const answer = await question(
|
||||||
"This installation has already been modified. Overwrite? [Y/n]: "
|
"This installation has already been modified. Overwrite? [Y/n]: "
|
||||||
|
|
Loading…
Reference in a new issue