Files
Ruokamanageri/src/main/java/fi/lpam/Main.java
T
laurimaaninka 2eb3b4e18d Versio 3.1.0
Signed-off-by: laurimaaninka <lauri.maaninka@gmail.com>
2026-05-11 15:52:30 +03:00

43 lines
1.2 KiB
Java

package fi.lpam;
import org.apache.commons.lang3.SystemUtils;
import java.io.*;
import java.nio.file.Path;
import java.util.Properties;
public class Main {
public static boolean dev;
public static Properties properties;
public static final File asetustiedosto = Path.of(SystemUtils.getUserHome().getAbsolutePath(), "OneDrive", "Kuljetusruokasovellus", "asetukset.properties").toFile();
static void main(String[] args) {
//noinspection RedundantIfStatement
if (args.length > 0) {
dev = true;
} else {
dev = false;
}
try {
Properties defaults = new Properties();
defaults.load(Main.class.getClassLoader().getResourceAsStream("defaults.properties"));
properties = new Properties(defaults);
properties.load(new FileInputStream(asetustiedosto));
}
catch (IOException e) {
//noinspection CallToPrintStackTrace
e.printStackTrace();
}
App.main();
try (OutputStream os = new FileOutputStream(asetustiedosto)) {
properties.store(os, "");
} catch (IOException e) {
//noinspection CallToPrintStackTrace
e.printStackTrace();
}
}
}