mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2024-11-14 21:37:52 -07:00
Android: Make rescan on app start work again
I haven't fully confirmed why the previous commit broke this, but I imagine it's due to AfterDirectoryInitializationRunner executing in a different order than before, resulting in startRescan running before startLoad.
This commit is contained in:
parent
bb475391d2
commit
c2aa2818be
@ -26,6 +26,7 @@ public final class GameFileCacheManager
|
||||
private static GameFileCache gameFileCache = null;
|
||||
private static final MutableLiveData<GameFile[]> gameFiles =
|
||||
new MutableLiveData<>(new GameFile[]{});
|
||||
private static boolean runRescanAfterLoad = false;
|
||||
|
||||
private static final ExecutorService executor = Executors.newFixedThreadPool(1);
|
||||
private static final MutableLiveData<Boolean> loadInProgress = new MutableLiveData<>(false);
|
||||
@ -135,7 +136,8 @@ public final class GameFileCacheManager
|
||||
/**
|
||||
* Asynchronously scans for games in the user's configured folders,
|
||||
* updating the game file cache with the results.
|
||||
* If startLoad hasn't been called before this, this has no effect.
|
||||
* If loading the game file cache hasn't started or hasn't finished,
|
||||
* the execution of this will be postponed until it finishes.
|
||||
*/
|
||||
public static void startRescan(Context context)
|
||||
{
|
||||
@ -190,17 +192,33 @@ public final class GameFileCacheManager
|
||||
}
|
||||
}
|
||||
|
||||
if (runRescanAfterLoad)
|
||||
{
|
||||
rescanInProgress.postValue(true);
|
||||
}
|
||||
|
||||
loadInProgress.postValue(false);
|
||||
|
||||
if (runRescanAfterLoad)
|
||||
{
|
||||
runRescanAfterLoad = false;
|
||||
rescan();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Scans for games in the user's configured folders,
|
||||
* updating the game file cache with the results.
|
||||
* If load hasn't been called before this, this has no effect.
|
||||
* If load hasn't been called before this, the execution of this
|
||||
* will be postponed until after load runs.
|
||||
*/
|
||||
private static void rescan()
|
||||
{
|
||||
if (gameFileCache != null)
|
||||
if (gameFileCache == null)
|
||||
{
|
||||
runRescanAfterLoad = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
String[] gamePaths = GameFileCache.getAllGamePaths();
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user