Skip to content

Commit

Permalink
2.2.35
Browse files Browse the repository at this point in the history
  • Loading branch information
Razviar committed Oct 28, 2024
1 parent a250046 commit 61b79d8
Show file tree
Hide file tree
Showing 3 changed files with 43 additions and 6 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "mtgaprotracker",
"productName": "mtgaprotracker",
"version": "2.2.34",
"version": "2.2.35",
"description": "MTG Arena Tracker",
"main": "./.webpack/main",
"scripts": {
Expand Down
25 changes: 24 additions & 1 deletion src/app/do-path-ops.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,35 @@
import {app} from 'electron';
import {join} from 'path';
import fs from 'fs';
import {uploadCardData} from 'root/app/cards_uploader';
import {withHomeWindow} from 'root/app/main_window';
import {sendMessageToHomeWindow} from 'root/app/messages';
import {locateMtgaDir} from 'root/app/mtga_dir_ops';
import {showNotification} from 'root/app/notification';
import {settingsStore} from 'root/app/settings-store/settings_store';
import {gameState} from 'root/app/game_state';

export function doMtgaPathOps(): void {
//console.log('doMtgaPathOps');
const home = app.getAppPath();
const checker = join(home, '.webpack', 'main', 'native_modules', 'SharpMonoInjector.dll');
let sharpInPlace = false;
try {
const checkSharpMonoInjector = fs.statSync(checker);
if (checkSharpMonoInjector.size && checkSharpMonoInjector.size > 24000) {
sharpInPlace = true;
}
} catch (err) {}

if (!sharpInPlace) {
gameState.setAVBlocked();
withHomeWindow((w) => {
showNotification(
'Please Restore SharpMonoInjector.dll!',
'Your AV most likely removed SharpMonoInjector.dll, please add an exception for this file and re-install the tracker!'
);
});
}

let mtgaPath = settingsStore.get().mtgaPath;
//console.log('mtgaPath1', mtgaPath);
if (mtgaPath === undefined && locateMtgaDir(mtgaPath)) {
Expand Down
22 changes: 18 additions & 4 deletions src/app/mtga_dir_ops.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,14 +19,28 @@ export function locateMtgaDir(checkPath: string | undefined): boolean {
} else {
const progFiles = process.env['ProgramFiles'];
const progFilesX86 = process.env['ProgramFiles(x86)'];
const disk = process.env['SystemDrive'];

const getAllDisks = (): string[] => {
const disks: string[] = [];
const drives = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'.split('');
drives.forEach((drive) => {
const drivePath = `${drive}:\\`;
if (fs.existsSync(drivePath) && fs.statSync(drivePath).isDirectory()) {
disks.push(drivePath);
}
});
return disks;
};

const allDisks = getAllDisks();
allDisks.forEach((disk) => {
MtgaPathLocator.push([disk, 'SteamLibrary', 'steamapps', 'common', 'MTGA', 'MTGA_Data']);
});

if (progFiles === undefined) {
return false;
}
if (disk !== undefined) {
MtgaPathLocator.push([disk, 'SteamLibrary', 'steamapps', 'common', 'MTGA', 'MTGA_Data']);
}

MtgaPathLocator.push([progFiles, 'Wizards of the Coast', 'MTGA', 'MTGA_Data']);
MtgaPathLocator.push([progFiles, 'Epic Games', 'MagicTheGathering', 'MTGA_Data']);
MtgaPathLocator.push([progFiles, 'Steam', 'steamapps', 'common', 'MTGA', 'MTGA_Data']);
Expand Down

0 comments on commit 61b79d8

Please sign in to comment.