From be8442cef156192826420cedf133de8dde56320a Mon Sep 17 00:00:00 2001 From: rusefillc Date: Thu, 21 Nov 2024 17:47:47 -0500 Subject: [PATCH] only:prependIfNotAbsolute --- .../src/main/java/com/rusefi/IoUtil2.java | 10 +--------- .../src/main/java/com/rusefi/IoUtil3.java | 13 +++++++++++++ .../src/main/java/com/rusefi/VariableRegistry.java | 2 +- 3 files changed, 15 insertions(+), 10 deletions(-) create mode 100644 java_tools/enum_to_string/src/main/java/com/rusefi/IoUtil3.java 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 90721ba7b1..9294612f2c 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(prependIfNotAbsolute(RootHolder.ROOT, fileName)); + File file = new File(IoUtil3.prependIfNotAbsolute(RootHolder.ROOT, fileName)); byte[] fileContent = Files.readAllBytes(file.toPath()); for (int i = 0; i < fileContent.length; i++) { byte aByte = fileContent[i]; @@ -45,14 +45,6 @@ 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 long crc32 = 0; diff --git a/java_tools/enum_to_string/src/main/java/com/rusefi/IoUtil3.java b/java_tools/enum_to_string/src/main/java/com/rusefi/IoUtil3.java new file mode 100644 index 0000000000..5909aac8a2 --- /dev/null +++ b/java_tools/enum_to_string/src/main/java/com/rusefi/IoUtil3.java @@ -0,0 +1,13 @@ +package com.rusefi; + +import java.io.File; + +public class IoUtil3 { + public static String prependIfNotAbsolute(String prefix, String fileName) { + if (new File(fileName).isAbsolute()) { + return fileName; + } else { + return prefix + fileName; + } + } +} diff --git a/java_tools/enum_to_string/src/main/java/com/rusefi/VariableRegistry.java b/java_tools/enum_to_string/src/main/java/com/rusefi/VariableRegistry.java index d013aba659..b89db9caeb 100644 --- a/java_tools/enum_to_string/src/main/java/com/rusefi/VariableRegistry.java +++ b/java_tools/enum_to_string/src/main/java/com/rusefi/VariableRegistry.java @@ -61,7 +61,7 @@ public class VariableRegistry { } public void readPrependValues(String prependFile, boolean ignoreUnexpectedLined) { - File file = new File(RootHolder.ROOT + prependFile); + File file = new File(IoUtil3.prependIfNotAbsolute(RootHolder.ROOT, prependFile)); try { readPrependValues(new FileReader(file), ignoreUnexpectedLined); } catch (Throwable e) {