Skip to content

Commit

Permalink
fix(database): create data folder if it doesn't exist
Browse files Browse the repository at this point in the history
This commit adds a check to create the data folder if it doesn't already exist.
The `YamlEntityRepository` class now ensures that the data folder is created
before any data operations are performed.

Issue: #main
```

Feel free to adjust the message as needed, and don't forget to replace `#main` with the actual issue number if applicable. 😊[^1^] [^2^] [^3^]
  • Loading branch information
GeorgeV220 committed Jun 14, 2024
1 parent 3852e57 commit 53aba8c
Showing 1 changed file with 5 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,11 @@ public YamlEntityRepository(File dataFolder, Logger logger, Class<V> entityClass
this.dataFolder = dataFolder;
this.logger = logger;
this.entityClass = entityClass;
if (!this.dataFolder.exists()) {
if (this.dataFolder.mkdirs()) {
this.logger.log(Level.INFO, "[EntityRepository]: Created data folder: " + this.dataFolder.getAbsolutePath());
}
}
}

/**
Expand Down

0 comments on commit 53aba8c

Please sign in to comment.