Skip to content

Commit

Permalink
Fix paths for MacOS
Browse files Browse the repository at this point in the history
  • Loading branch information
thomasmarton authored and Hi-Ray committed Jan 29, 2021
1 parent f21c4c3 commit 04bc3e6
Showing 1 changed file with 22 additions and 4 deletions.
26 changes: 22 additions & 4 deletions app/util/RiotConnector.ts
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ export default class RiotConnector extends EventEmitter {
*/
const command: string = IS_WIN
? `WMIC PROCESS WHERE name='${RIOTCLIENT_PROCESS}' GET CommandLine`
: `ps x -o comm= | grep '${RIOTCLIENT_PROCESS}$'`;
: `ps x -o command= | grep '${RIOTCLIENT_PROCESS}'`;

/**
* Execute the command
Expand Down Expand Up @@ -94,23 +94,41 @@ export default class RiotConnector extends EventEmitter {
*/
if (!match) {
let product: string = normalizedPath.match(
'--launch-product=(.*?)[ $"]'
(platform() !== 'darwin')
? '--launch-product=(.*?)[ $"]'
: '--upgrade-product=(.*?)[ $"\n]'
)[1];
let patchline: string = normalizedPath.match(
'--launch-patchline=(.*?)[ $"]'
(platform() !== 'darwin')
? '--launch-patchline=(.*?)[ $"]'
: '--upgrade-patchline=(.*?)[ $"\n]'
)[1];

/**
* There is no ProgramData folder on MacOS
*/
let programData = process.env.ProgramData;
if (platform() === 'darwin')
programData = '/Users/Shared';

this.leaguePath = parseDocument(
readFileSync(
path.join(
process.env.ProgramData,
programData,
"Riot Games",
"MetaData",
`${product}.${patchline}`,
`${product}.${patchline}.product_settings.yaml`
)
).toString()
).get("product_install_full_path");

if (platform() === 'darwin')
this.leaguePath = path.join(
this.leaguePath,
'Contents',
'LoL'
);
} else {
this.leaguePath = path.dirname(match[1]);
}
Expand Down

0 comments on commit 04bc3e6

Please sign in to comment.