3
0
Mirror von https://github.com/PaperMC/Velocity.git synchronisiert 2024-11-17 05:20:14 +01:00

Specify an explicit path instead of using Paths.get() to construct it

Dieser Commit ist enthalten in:
Andrew Steinborn 2021-04-19 07:54:48 -04:00
Ursprung efa9f6f303
Commit 6a349d24ac
2 geänderte Dateien mit 4 neuen und 4 gelöschten Zeilen

Datei anzeigen

@ -250,7 +250,7 @@ public class VelocityServer implements ProxyServer, ForwardingAudience {
translationRegistry.defaultLocale(Locale.US);
try {
FileSystemUtils.visitResources(VelocityServer.class,
Paths.get("com", "velocitypowered", "proxy", "l10n"), path -> {
"com/velocitypowered/proxy/l10n", path -> {
logger.info("Loading localizations...");
try {

Datei anzeigen

@ -42,14 +42,14 @@ public class FileSystemUtils {
* @param consumer The consumer to visit the resolved path
*/
@SuppressFBWarnings({"RCN_REDUNDANT_NULLCHECK_WOULD_HAVE_BEEN_A_NPE"})
public static boolean visitResources(Class<?> target, Path path, Consumer<Path> consumer)
public static boolean visitResources(Class<?> target, String path, Consumer<Path> consumer)
throws IOException {
final File file = new File(target
.getProtectionDomain().getCodeSource().getLocation().getPath());
if (file.isFile()) { // jar
try (FileSystem fileSystem = FileSystems.newFileSystem(file.toPath(), (ClassLoader) null)) {
Path toVisit = fileSystem.getPath(path.toString());
Path toVisit = fileSystem.getPath(path);
if (Files.exists(toVisit)) {
consumer.accept(toVisit);
return true;
@ -59,7 +59,7 @@ public class FileSystemUtils {
} else {
URI uri;
try {
URL url = target.getClassLoader().getResource(path.toString());
URL url = target.getClassLoader().getResource(path);
if (url == null) {
return false;
}