Skip to content

Commit

Permalink
on SVDataManager save deletion protocol, besides the check of [no roo…
Browse files Browse the repository at this point in the history
…t keys], also check if the [all root keys are not empty].
  • Loading branch information
EverNife committed Aug 8, 2024
1 parent 5f72caa commit 8a6578d
Showing 1 changed file with 5 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,11 @@ public void save(){

//Finally, delete all empty Configs, no need to remove them from the map though
for (Config config : this.configData.getAllConfigs()) {
if (config.getKeys().isEmpty()){
boolean isEmpty = config.getKeys().isEmpty()
? true
: config.getKeys().stream().filter(s -> !config.getKeys(s).isEmpty()).findFirst().isPresent() == false;

if (isEmpty){
if (config.getTheFile().exists()){
FileUtils.deleteQuietly(config.getTheFile());
}
Expand Down

0 comments on commit 8a6578d

Please sign in to comment.