Skip to content

Commit

Permalink
Check if prefix is defined before checking for IPC
Browse files Browse the repository at this point in the history
Signed-off-by: Ovenoboyo <[email protected]>
  • Loading branch information
Ovenoboyo committed Aug 24, 2022
1 parent 01b366a commit 4cb22aa
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions src/discordRPC/ipcTransport.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,15 +38,15 @@ export class IPCTransport {
if (process.platform === 'win32') {
return `\\\\?\\pipe\\discord-ipc-${id}`
}
const {
env: { XDG_RUNTIME_DIR, TMPDIR, TMP, TEMP }
} = process

const { XDG_RUNTIME_DIR, TMPDIR, TMP, TEMP } = process.env
const prefix = [`${XDG_RUNTIME_DIR}/app/com.discordapp.Discord`, XDG_RUNTIME_DIR, TMPDIR, TMP, TEMP, '/tmp']

for (const p of prefix) {
const path = `${p.replace(/\/$/, '')}/discord-ipc-${id}`
if (await this.tryAccess(path)) {
return path
if (p) {
const path = `${p.replace(/\/$/, '')}/discord-ipc-${id}`
if (await this.tryAccess(path)) {
return path
}
}
}
return ''
Expand Down

0 comments on commit 4cb22aa

Please sign in to comment.