Skip to content

Commit

Permalink
fixed preferred order relying on ordinals
Browse files Browse the repository at this point in the history
  • Loading branch information
jagrosh committed Nov 16, 2017
1 parent efaa756 commit f0b6c63
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 2 deletions.
9 changes: 9 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,14 @@
# DiscordIPC

Connect locally to the Discord client using IPC for a subset of RPC features like Rich Presence and Activity Join/Spectate

# Disclaimer

This is still heavily WIP. Expect errors, unsupported operating systems, and missing features.


# Official Discord-RPC Bindings

The official RPC bindings can be found here: https://github.com/discordapp/discord-rpc

A Java wrapper for the official bindings is available here: https://github.com/MinnDevelopment/Java-DiscordRPC
6 changes: 4 additions & 2 deletions src/main/java/com/jagrosh/discordipc/IPCClient.java
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ public void connect(DiscordBuild... preferredOrder) throws NoDiscordClientExcept
break;

open[build.ordinal()] = pipe; // didn't find first choice yet, so store what we have
open[0] = pipe; // also store in 'any' for use later
open[DiscordBuild.ANY.ordinal()] = pipe; // also store in 'any' for use later

build = null;
pipe = null;
Expand Down Expand Up @@ -179,8 +179,10 @@ public void connect(DiscordBuild... preferredOrder) throws NoDiscordClientExcept
throw new NoDiscordClientException();
}
// close unused files, except skip 'any' because its always a duplicate
for(int i = 1; i < open.length; i++)
for(int i = 0; i < open.length; i++)
{
if(i == DiscordBuild.ANY.ordinal())
continue;
if(open[i] != null)
{
try {
Expand Down

0 comments on commit f0b6c63

Please sign in to comment.