diff --git a/main/src/host-files/GameLogWatcher.ts b/main/src/host-files/GameLogWatcher.ts index 520eb56ae..f10ad716d 100644 --- a/main/src/host-files/GameLogWatcher.ts +++ b/main/src/host-files/GameLogWatcher.ts @@ -1,11 +1,7 @@ import { promises as fs, watchFile, unwatchFile } from 'fs' import { ServerEvents } from '../server' import { Logger } from '../RemoteLogger' - -const COMMON_PATH = [ - 'C:\\Program Files (x86)\\Grinding Gear Games\\Path of Exile\\logs\\Client.txt', - 'C:\\Program Files (x86)\\Steam\\steamapps\\common\\Path of Exile\\logs\\Client.txt' -] +import { app } from 'electron'; export class GameLogWatcher { private offset = 0 @@ -22,8 +18,21 @@ export class GameLogWatcher { async restart (logFile: string | null) { if (this.filePath === logFile) return - if (!logFile && process.platform === 'win32') { - for (const filePath of COMMON_PATH) { + if (!logFile) { + let possiblePaths: string[] = [] + if (process.platform === 'win32') { + possiblePaths = [ + 'C:\\Program Files (x86)\\Grinding Gear Games\\Path of Exile\\logs\\Client.txt', + 'C:\\Program Files (x86)\\Steam\\steamapps\\common\\Path of Exile\\logs\\Client.txt' + ] + } else if (process.platform === 'darwin') { + possiblePaths = [ + // Path from https://www.pathofexile.com/forum/view-thread/3233960 + `${app.getPath('home')}/Library/Caches/com.GGG.PathOfExile/Logs/Client.txt` + ] + } + + for (const filePath of possiblePaths) { try { await fs.access(filePath) // this.server.sendEventTo('any', { @@ -32,7 +41,8 @@ export class GameLogWatcher { // }) logFile = filePath break - } catch {} + } catch { + } } }