Update gitignore and config

This commit is contained in:
floppydiskette 2024-08-21 21:14:44 +01:00
commit 89e8e3f4f6
No known key found for this signature in database
3 changed files with 46 additions and 3 deletions

View file

@ -19,12 +19,11 @@ public class Config {
* @throws IOException if the config JSON could not be read
*/
public static Config readConfig() throws IOException {
System.out.println(Path.of("config.json"));
try (InputStream in=Thread.currentThread().getContextClassLoader().getResourceAsStream("config.json")) {
assert in != null;
Reader reader = new InputStreamReader(in, StandardCharsets.UTF_8);
return new Gson().fromJson(reader, Config.class);
} catch (IOException e) {
} catch (IOException | NullPointerException e) {
throw new IOException("""
config.json was not found in the root folder (of the project), did you forget to put it ?
Example structure: