only:prependIfNotAbsolute

This commit is contained in:
rusefillc 2024-11-21 17:47:47 -05:00
parent bb9a9da1f5
commit be8442cef1
3 changed files with 15 additions and 10 deletions

View File

@ -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<String> inputFileNames) throws IOException {
// get CRC32 of given input files
long crc32 = 0;

View File

@ -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;
}
}
}

View File

@ -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) {