Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Look for multiple paths #639

Open
wants to merge 3 commits into
base: v2
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 16 additions & 10 deletions injectors/linux.js
Original file line number Diff line number Diff line change
Expand Up @@ -51,20 +51,19 @@ exports.getAppDir = async (platform) => {
.split('\n')
.map(s => s.split(' ').filter(Boolean))
.find(p => p[4] && (ProcessRegex[platform]).test(p[4]) && p.includes('--type=renderer'));

const askPath = () => new Promise(resolve => readlineInterface.question('> ', resolve));
const readlineInterface = readline.createInterface({
input: process.stdin,
output: process.stdout
});
if (!discordProcess) {
let discordPath = KnownLinuxPaths[platform].find(path => existsSync(path));
if (!discordPath) {
const readlineInterface = readline.createInterface({
input: process.stdin,
output: process.stdout
});

const askPath = () => new Promise(resolve => readlineInterface.question('> ', resolve));
let discordPaths = KnownLinuxPaths[platform].filter(path => existsSync(path));

if (!discordPaths[0]) {
console.log(`${AnsiEscapes.YELLOW}Failed to locate ${PlatformNames[platform]} installation folder.${AnsiEscapes.RESET}`, '\n');
console.log(`Please provide the path of your ${PlatformNames[platform]} installation folder`);
discordPath = await askPath();
readlineInterface.close();

if (!existsSync(discordPath)) {
console.log('');
Expand All @@ -73,9 +72,16 @@ exports.getAppDir = async (platform) => {
process.exit(process.argv.includes('--no-exit-codes') ? 0 : 1);
}
}
if(discordPaths.length > 1) {
console.log(`${AnsiEscapes.YELLOW}It seems like you have multiple canary instances. ${AnsiEscapes.RESET}`, '\n');
console.log('Please provide the path of your preffered Discord Canary installation folder');
discordPaths[0] = await askPath();

return join(discordPath, 'resources', 'app');
ZeoNight marked this conversation as resolved.
Show resolved Hide resolved
}

return join(discordPaths[0],'resources','app');
}
readlineInterface.close();

const discordPath = discordProcess[4].split('/');
discordPath.splice(discordPath.length - 1, 1);
Expand Down