Skip to content

Commit

Permalink
Add default game log location for Mac
Browse files Browse the repository at this point in the history
  • Loading branch information
hsource committed Dec 7, 2023
1 parent 285a628 commit 61ee202
Showing 1 changed file with 18 additions and 8 deletions.
26 changes: 18 additions & 8 deletions main/src/host-files/GameLogWatcher.ts
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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', {
Expand All @@ -32,7 +41,8 @@ export class GameLogWatcher {
// })
logFile = filePath
break
} catch {}
} catch {
}
}
}

Expand Down

0 comments on commit 61ee202

Please sign in to comment.