From a0c76b61b2dd48395da4fd31f598923071abd610 Mon Sep 17 00:00:00 2001 From: Joe Lauer Date: Mon, 30 Sep 2024 20:24:29 -0400 Subject: [PATCH] Fix Resources.file for linux/windows --- crux-util/src/main/java/com/fizzed/crux/util/Resources.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/crux-util/src/main/java/com/fizzed/crux/util/Resources.java b/crux-util/src/main/java/com/fizzed/crux/util/Resources.java index d38119a..073f834 100644 --- a/crux-util/src/main/java/com/fizzed/crux/util/Resources.java +++ b/crux-util/src/main/java/com/fizzed/crux/util/Resources.java @@ -135,7 +135,8 @@ static public void file(String resourceName, BiConsumer consumer) // we'll skip the file: part too String jarPath = jarPathAndInnerFile.substring(5, sepPos); // on windows, there's an extra / before the drive name - if (jarPath.charAt(0) == '/' && jarPath.indexOf(':') <= 5) { + int colonPos = jarPath.indexOf(':'); + if (jarPath.charAt(0) == '/' && colonPos > 0 && colonPos <= 5) { // we'll chop off the leading / char jarPath = jarPath.substring(1); }