Skip to content
Snippets Groups Projects
Commit 731f9fb1 authored by Georg Graßnick's avatar Georg Graßnick :thinking:
Browse files

Fix PropertiesParser constructor in main method

parent 84bb8307
No related branches found
No related tags found
1 merge request!36Bug/file path issues
......@@ -43,11 +43,11 @@ import tec.units.ri.unit.MetricPrefix;
import javax.measure.Quantity;
import javax.measure.quantity.Length;
import java.io.BufferedReader;
import java.io.File;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.Reader;
import java.net.URL;
import java.nio.file.Path;
import java.util.Optional;
import java.util.concurrent.ConcurrentLinkedDeque;
......@@ -169,16 +169,17 @@ public final class App {
}
// Config Parsing
URL configPath;
JavaPropertiesConfigurationParser configParser;
URL defaultConfig = getClass().getClassLoader().getResource("config/default.properties");
if (!settingsReader.isPresent(SettingType.PRINTER_CONFIG_PATH)) { // TODO: exception if missing this argument, until then use default location for test runs
configPath = getClass().getResource("/config/index_everest_d_v4.properties");
URL configUrl = getClass().getResource("/config/index_everest_d_v4.properties");
configParser = new JavaPropertiesConfigurationParser(configUrl, defaultConfig);
mLogger.warn("ATTENTION! Using default specific config from resources. Please remove default config behavior before packaging the jar.");
} else {
File configFile = new File(settingsReader.getSetting(SettingType.PRINTER_CONFIG_PATH).get());
configPath = configFile.toURL();
Path configPath = Path.of(settingsReader.getSetting(SettingType.PRINTER_CONFIG_PATH).get());
configParser = new JavaPropertiesConfigurationParser(configPath, defaultConfig);
}
JavaPropertiesConfigurationParser configParser = new JavaPropertiesConfigurationParser(configPath, getClass().getClassLoader().getResource("config/default.properties"));
Printer indexV4Printer = configParser.getPrinter();
Format a4Format = configParser.getFormat("A4");
Representation representationParameters = configParser.getRepresentation();
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment