Force refreshing version list when remove version from disk

This commit is contained in:
huanghongxun 2019-04-25 13:39:07 +08:00
parent c209617ee7
commit 1956ba7a73
2 changed files with 22 additions and 20 deletions

View File

@ -50,9 +50,7 @@ public class Versions {
isMovingToTrashSupported ? i18n("version.manage.remove.confirm.trash", version, version + "_removed") :
i18n("version.manage.remove.confirm", version);
Controllers.confirmDialog(message, i18n("message.confirm"), () -> {
if (profile.getRepository().removeVersionFromDisk(version)) {
profile.getRepository().refreshVersionsAsync().start();
}
profile.getRepository().removeVersionFromDisk(version);
}, null);
}

View File

@ -166,6 +166,7 @@ public class DefaultGameRepository implements GameRepository {
if (!file.renameTo(removedFile))
return false;
try {
versions.remove(id);
if (FileUtils.isMovingToTrashSupported() && FileUtils.moveToTrash(removedFile)) {
@ -185,6 +186,9 @@ public class DefaultGameRepository implements GameRepository {
LOG.log(Level.WARNING, "Unable to remove version folder: " + file, e);
}
return true;
} finally {
refreshVersionsAsync().start();
}
}
protected void refreshVersionsImpl() {