diff --git a/java_tools/configuration_definition/src/main/java/com/rusefi/IoUtil2.java b/java_tools/configuration_definition/src/main/java/com/rusefi/IoUtil2.java index 696448463a..90721ba7b1 100644 --- a/java_tools/configuration_definition/src/main/java/com/rusefi/IoUtil2.java +++ b/java_tools/configuration_definition/src/main/java/com/rusefi/IoUtil2.java @@ -33,7 +33,7 @@ public class IoUtil2 { } private static long getCrc32(String fileName) throws IOException { - File file = new File(RootHolder.ROOT + fileName); + File file = new File(prependIfNotAbsolute(RootHolder.ROOT, fileName)); byte[] fileContent = Files.readAllBytes(file.toPath()); for (int i = 0; i < fileContent.length; i++) { byte aByte = fileContent[i]; @@ -45,6 +45,13 @@ public class IoUtil2 { return c.getValue(); } + private static String prependIfNotAbsolute(String prefix, String fileName) { + if (new File(fileName).isAbsolute()) { + return fileName; + } else { + return prefix + fileName; + } + } static long getCrc32(List inputFileNames) throws IOException { // get CRC32 of given input files