fix: resolve issue with resource filepath

This commit is contained in:
Zhongheng Liu 2025-12-05 16:10:01 +01:00
commit 4bb595dc6b
Signed by: steven
GPG key ID: F69B980899C1C09D

View file

@ -18,7 +18,6 @@ package client;
import java.io.IOException; import java.io.IOException;
import java.net.URL; import java.net.URL;
import java.nio.charset.StandardCharsets; import java.nio.charset.StandardCharsets;
import java.nio.file.Path;
import com.google.inject.Injector; import com.google.inject.Injector;
@ -49,7 +48,7 @@ public class MyFXML {
} }
private URL getLocation(String... parts) { private URL getLocation(String... parts) {
var path = Path.of("", parts).toString(); var path = String.join("/", parts);
return MyFXML.class.getClassLoader().getResource(path); return MyFXML.class.getClassLoader().getResource(path);
} }
@ -71,4 +70,4 @@ public class MyFXML {
return injector.getInstance(type); return injector.getInstance(type);
} }
} }
} }