Skip to content

Commit

Permalink
Fix path on MacOS
Browse files Browse the repository at this point in the history
  • Loading branch information
Benricheson101 committed Aug 27, 2021
1 parent 6f83d8d commit 8e8debe
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions src/transports/ipc.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
'use strict';

const os = require('os');
const path = require('path');
const net = require('net');
const EventEmitter = require('events');
const fetch = require('node-fetch');
Expand All @@ -17,6 +19,15 @@ function getIPCPath(id) {
if (process.platform === 'win32') {
return `\\\\?\\pipe\\discord-ipc-${id}`;
}

if (process.platform === 'darwin') {
let tmpdir = os.tmpdir();
if (!tmpdir.endsWith('/T')) {
tmpdir = path.dirname(tmpdir);
}
return `${tmpdir}/discord-ipc-${id}`;
}

const { env: { XDG_RUNTIME_DIR, TMPDIR, TMP, TEMP } } = process;
const prefix = XDG_RUNTIME_DIR || TMPDIR || TMP || TEMP || '/tmp';
return `${prefix.replace(/\/$/, '')}/discord-ipc-${id}`;
Expand Down

0 comments on commit 8e8debe

Please sign in to comment.