mirror of
https://github.com/plan-player-analytics/Plan.git
synced 2024-11-05 02:09:50 +01:00
Added enable exceptions if data folder or config file can't be created.
This commit is contained in:
parent
d9f8d09607
commit
89bac474a7
@ -62,11 +62,12 @@ public class FileSystem implements SubSystem {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void enable() throws EnableException {
|
public void enable() throws EnableException {
|
||||||
dataFolder.mkdirs();
|
Verify.isTrue((dataFolder.exists() && dataFolder.isDirectory()) || dataFolder.mkdirs(),
|
||||||
|
() -> new EnableException("Could not create data folder at " + dataFolder.getAbsolutePath()));
|
||||||
try {
|
try {
|
||||||
if (configFile.exists()) {
|
Verify.isTrue((configFile.exists() && configFile.isFile()) || configFile.createNewFile(),
|
||||||
configFile.createNewFile();
|
() -> new EnableException("Could not create config file at " + configFile.getAbsolutePath()));
|
||||||
}
|
|
||||||
RunnableFactory.createNew(new LogsFolderCleanTask(Log.getLogsFolder()))
|
RunnableFactory.createNew(new LogsFolderCleanTask(Log.getLogsFolder()))
|
||||||
.runTaskLaterAsynchronously(TimeAmount.SECOND.ticks() * 30L);
|
.runTaskLaterAsynchronously(TimeAmount.SECOND.ticks() * 30L);
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
|
Loading…
Reference in New Issue
Block a user