Added option for persistent resources like configuration files
This commit is contained in:
@@ -11,7 +11,7 @@ import java.util.logging.Logger;
|
||||
* Predefined resources which are extracted on Runtime
|
||||
*/
|
||||
public enum Resource {
|
||||
CONFIG("config.yml"),
|
||||
CONFIG("config.yml", true),
|
||||
HUB_MAP("maps/hub"),
|
||||
LOBBY_MAP("maps/lobby"),
|
||||
|
||||
@@ -20,18 +20,22 @@ public enum Resource {
|
||||
|
||||
private final Path path;
|
||||
private final String name;
|
||||
Resource(String name) {
|
||||
Resource(String name, boolean keepOutdated) {
|
||||
this.name = name;
|
||||
this.path = Path.of("resources/" + name);
|
||||
|
||||
try {
|
||||
Logger.getLogger("ressource").info("extracting resource " + name + " ... ");
|
||||
ResourceUtils.extractResource(name);
|
||||
ResourceUtils.extractResource(name, keepOutdated);
|
||||
} catch (URISyntaxException | IOException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
}
|
||||
|
||||
Resource(String name) {
|
||||
this(name, false);
|
||||
}
|
||||
|
||||
public Path getPath() {
|
||||
return path;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user