This commit is contained in:
lukasabbe
2025-10-08 10:32:40 +02:00
parent 8750d28667
commit 47b10cfe05
9 changed files with 36 additions and 23 deletions
@@ -19,7 +19,7 @@ public class Config {
public void loadConfig(){
Path configPath = Services.PLATFORM.getConfigPath("bookshelfinspector-config.yml");
if(!Files.exists(configPath))createConfig(configPath);
if(!Files.exists(configPath)) createConfig(configPath);
Yaml yaml = new Yaml();
try{
Map<String, Object> configMap = yaml.load(new FileReader(configPath.toFile()));
@@ -39,7 +39,8 @@ public class Config {
}
private void createConfig(Path configPath){
Path defaultConfigPath = Services.PLATFORM.getFileInModContainer("bookshelfinspector", "bookshelfinspector-config.yml");
Path defaultConfigPath = Services.PLATFORM.getFileOrCopyInModContainer("bookshelfinspector", "bookshelfinspector-config.yml");
if(defaultConfigPath == null) return;
try {
Files.copy(defaultConfigPath, configPath);
} catch (IOException e) {
@@ -9,5 +9,5 @@ public interface IPlatformHelper {
Path getConfigPath(String file);
Path getFileInModContainer(String mod, String fileName);
Path getFileOrCopyInModContainer(String mod, String fileName);
}