JnCrMx / discord-game-sdk4j

Java bindings for Discord's Game SDK
MIT License
122 stars 23 forks source link

`FileNotFoundException` with Java 22 (java-impl branch) #79

Closed Desoroxxx closed 6 months ago

Desoroxxx commented 7 months ago

Updated my project to Java 22, launched my game and https://mclo.gs/IxPgr6c then I went back to Java 21 and it worked again, so it seems this is incompatible with Java 21 as is.

Desoroxxx commented 7 months ago

From answers that I got on a Java Discord and testing, it seems that simply changing for example \\\\?\\pipe\\discord-ipc-0 to \\\\.\\pipe\\discord-ipc-0 should work. ? apparently worked by accident

JnCrMx commented 7 months ago

This seems to be correct, at least according to the Microsoft documentation.

@letorbi Do you have any thoughts on this? I am no expert on the Windows side of things, sadly...

letorbi commented 7 months ago

I am also more a Linux user than a Windows expert, but \\\\?\\pipe actually seems to be a mistake. As stated in my related PR #61, I just copied the path from the Rust discord-sdk project...

I don't know why Rust discord-sdk uses ? instead of ., but if the latter works with Java 22 and Java 21 and is also the proper way to access a pipe, I guess we should change our path to \\\\.\\pipe\\discord-ipc-0.

Unfortunately I cannot test the change, because I don't have a Windows computer at hand right now.

Desoroxxx commented 7 months ago

I forgot to mention since my last comment I tried creating a RandomAccessFile with ? in my own project wich lead to a FNF on J22 I then tried with . and that worked no FNF was thrown. So from my testing it seems that it would work

Desoroxxx commented 6 months ago

Do you want me to create a PR for this? This is the only thing preventing me migrating to J22 😅

letorbi commented 6 months ago

I think @immails has already created #81 to fix this issue.

cedricwiesel commented 6 months ago

Hey there @JnCrMx, Is there any chance the fix from the above mentioned PR could be implemented anytime soon? I am currently using this library for a project at uni and am experiencing the error. I cannot edit the library locally since I am required to import any used dependencies via gradle so I am very reliant on this getting fixed. Thanks in advance!

letorbi commented 6 months ago

@cedricwiesel For the meantime you could use JitPack to import @immails master branch, which contains the fix, into your project. See https://jitpack.io/#immails/discord-game-sdk4j/master-SNAPSHOT for details.

JnCrMx commented 6 months ago

I merged #81 and I hope this issue is fixed now ^^

If there's any more problems related to this, feel free to comment and I'll reopen the issue.