mirror of
https://github.com/lukasabbe/bookshelf-inspector.git
synced 2026-04-30 10:40:53 +00:00
1.21.10
This commit is contained in:
@@ -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) {
|
||||
|
||||
+1
-1
@@ -9,5 +9,5 @@ public interface IPlatformHelper {
|
||||
|
||||
Path getConfigPath(String file);
|
||||
|
||||
Path getFileInModContainer(String mod, String fileName);
|
||||
Path getFileOrCopyInModContainer(String mod, String fileName);
|
||||
}
|
||||
Reference in New Issue
Block a user