Skip to content

Commit

Permalink
fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
Ishan09811 authored Feb 11, 2024
1 parent 0cdee80 commit 3853f3c
Showing 1 changed file with 0 additions and 21 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -44,32 +44,11 @@ public void onRefresh() {
}

private void refreshGameList() {
// Check and remove invalid games
removeInvalidGames();

// Refresh the game list
gameListView.setGameList(GameUtils.getGames());
swipeRefreshLayout.setRefreshing(false);
}

private void removeInvalidGames() {
List<GameMetadata> gamesToRemove = new ArrayList<>();
for (GameMetadata game : GameUtils.getGames()) {
String gamePath = game.getRomPath();
if (gamePath != null) {
File gameFile = new File(gamePath);
if (!gameFile.exists()) {
// Path doesn't exist, mark game for removal
gamesToRemove.add(game);
}
}
}
// Remove invalid games from GameUtils
for (GameMetadata game : gamesToRemove) {
GameUtils.removeGame(game);
}
}

@Override
public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceState) {
super.onViewCreated(view, savedInstanceState);
Expand Down

0 comments on commit 3853f3c

Please sign in to comment.