From e4f20cf49ab6099feb5de3ec3e1c8044d783bfd9 Mon Sep 17 00:00:00 2001 From: rusefillc Date: Sat, 17 Jun 2023 17:00:25 -0400 Subject: [PATCH] only:Improve toolset for default tune canned tune generation #4871 --- .../src/main/java/com/rusefi/FiringOrderTSLogic.java | 2 +- .../src/main/java/com/rusefi/IoUtil2.java | 2 +- .../src/main/java/com/rusefi/ReaderStateImpl.java | 4 +--- .../enum_to_string/src/main/java/com/rusefi/RootHolder.java | 5 +++++ .../src/main/java/com/rusefi/VariableRegistry.java | 2 +- 5 files changed, 9 insertions(+), 6 deletions(-) create mode 100644 java_tools/enum_to_string/src/main/java/com/rusefi/RootHolder.java diff --git a/java_tools/configuration_definition/src/main/java/com/rusefi/FiringOrderTSLogic.java b/java_tools/configuration_definition/src/main/java/com/rusefi/FiringOrderTSLogic.java index 45c618efc6..4c61526e55 100644 --- a/java_tools/configuration_definition/src/main/java/com/rusefi/FiringOrderTSLogic.java +++ b/java_tools/configuration_definition/src/main/java/com/rusefi/FiringOrderTSLogic.java @@ -39,7 +39,7 @@ public class FiringOrderTSLogic { } private static void readFiringOrders(String fileName, State state) throws IOException { - BufferedReader br = new BufferedReader(new FileReader(fileName)); + BufferedReader br = new BufferedReader(new FileReader(RootHolder.ROOT + fileName)); String line; while ((line = br.readLine()) != null) { 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 727877fb22..463c80c98e 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 @@ -32,7 +32,7 @@ public class IoUtil2 { } private static long getCrc32(String fileName) throws IOException { - File file = new File(fileName); + File file = new File(RootHolder.ROOT + fileName); byte[] fileContent = Files.readAllBytes(file.toPath()); for (int i = 0; i < fileContent.length; i++) { byte aByte = fileContent[i]; diff --git a/java_tools/configuration_definition/src/main/java/com/rusefi/ReaderStateImpl.java b/java_tools/configuration_definition/src/main/java/com/rusefi/ReaderStateImpl.java index 77a5d2a4a5..e3797dc371 100644 --- a/java_tools/configuration_definition/src/main/java/com/rusefi/ReaderStateImpl.java +++ b/java_tools/configuration_definition/src/main/java/com/rusefi/ReaderStateImpl.java @@ -94,8 +94,6 @@ public class ReaderStateImpl implements ReaderState { @Override public void doJob() throws IOException { - if (destinations.isEmpty()) - throw new IllegalArgumentException("No destinations specified"); for (String prependFile : prependFiles) variableRegistry.readPrependValues(prependFile); @@ -105,7 +103,7 @@ public class ReaderStateImpl implements ReaderState { * the destinations/writers */ SystemOut.println("Reading definition from " + definitionInputFile); - BufferedReader definitionReader = new BufferedReader(new InputStreamReader(new FileInputStream(definitionInputFile), IoUtils.CHARSET.name())); + BufferedReader definitionReader = new BufferedReader(new InputStreamReader(new FileInputStream(RootHolder.ROOT + definitionInputFile), IoUtils.CHARSET.name())); readBufferedReader(definitionReader, destinations); if (destCDefinesFileName != null) { diff --git a/java_tools/enum_to_string/src/main/java/com/rusefi/RootHolder.java b/java_tools/enum_to_string/src/main/java/com/rusefi/RootHolder.java new file mode 100644 index 0000000000..6ee0d4dfdf --- /dev/null +++ b/java_tools/enum_to_string/src/main/java/com/rusefi/RootHolder.java @@ -0,0 +1,5 @@ +package com.rusefi; + +public class RootHolder { + public static String ROOT = ""; +} 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 7d1c54fff1..4bea2723d8 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) throws IOException { - readPrependValues(new FileReader(prependFile)); + readPrependValues(new FileReader(RootHolder.ROOT + prependFile)); } public void readPrependValues(Reader fileReader) throws IOException {