diff --git a/src/main/java/org/watermedia/WaterMedia.java b/src/main/java/org/watermedia/WaterMedia.java index c9bfaec7..ef300489 100644 --- a/src/main/java/org/watermedia/WaterMedia.java +++ b/src/main/java/org/watermedia/WaterMedia.java @@ -68,7 +68,7 @@ public void start() throws Exception { public static ILoader getLoader() { return bootstrap; } public static Path getConfigDir() { - return bootstrap.processDir().resolve("config/watermedia/"); + return bootstrap.processDir().resolve("config/watermedia"); } public static void setSlavismMode(boolean mode) { diff --git a/src/main/java/org/watermedia/api/player/PlayerAPI.java b/src/main/java/org/watermedia/api/player/PlayerAPI.java index 16b40e77..c8aa1d48 100644 --- a/src/main/java/org/watermedia/api/player/PlayerAPI.java +++ b/src/main/java/org/watermedia/api/player/PlayerAPI.java @@ -211,8 +211,15 @@ public Priority priority() { @Override public boolean supported() { + // first we check if (content == null) content = IOTool.readString(customPathFile); + + // then we reinforce + if (content == null) + return false; + + // now we validate File f = new File(content); return f.exists() && f.isDirectory(); } diff --git a/src/main/java/org/watermedia/core/tools/IOTool.java b/src/main/java/org/watermedia/core/tools/IOTool.java index 1c5feb81..cac36925 100644 --- a/src/main/java/org/watermedia/core/tools/IOTool.java +++ b/src/main/java/org/watermedia/core/tools/IOTool.java @@ -24,6 +24,7 @@ public static String readString(Path from) { byte[] bytes = DataTool.readAllBytes(in); return new String(bytes, StandardCharsets.UTF_8); } catch (Exception e) { + LOGGER.error(IT, "Failed to read text file", e); return null; } } @@ -40,7 +41,7 @@ public static GifDecoder readGif(Path path) { throw new IOException("Failed to process GIF - Decoder status: " + status); } catch (Exception e) { - LOGGER.error(IT, "Failed loading GIF from WaterMedia resources", e); + LOGGER.error(IT, "Failed reading GIF from disk", e); } return null; } @@ -54,6 +55,7 @@ public static boolean writeData(Path to, byte[] data) { os.write(data); return true; } catch (Exception e) { + LOGGER.error(IT, "Failed to write text file from disk", e); return false; } }