mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-04-24 22:34:54 +00: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
1 changed files with 21 additions and 3 deletions
|
@ -26,6 +26,7 @@ public final class GameFileCacheManager
|
||||||
private static GameFileCache gameFileCache = null;
|
private static GameFileCache gameFileCache = null;
|
||||||
private static final MutableLiveData<GameFile[]> gameFiles =
|
private static final MutableLiveData<GameFile[]> gameFiles =
|
||||||
new MutableLiveData<>(new GameFile[]{});
|
new MutableLiveData<>(new GameFile[]{});
|
||||||
|
private static boolean runRescanAfterLoad = false;
|
||||||
|
|
||||||
private static final ExecutorService executor = Executors.newFixedThreadPool(1);
|
private static final ExecutorService executor = Executors.newFixedThreadPool(1);
|
||||||
private static final MutableLiveData<Boolean> loadInProgress = new MutableLiveData<>(false);
|
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,
|
* Asynchronously scans for games in the user's configured folders,
|
||||||
* updating the game file cache with the results.
|
* 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)
|
public static void startRescan(Context context)
|
||||||
{
|
{
|
||||||
|
@ -190,17 +192,33 @@ public final class GameFileCacheManager
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (runRescanAfterLoad)
|
||||||
|
{
|
||||||
|
rescanInProgress.postValue(true);
|
||||||
|
}
|
||||||
|
|
||||||
loadInProgress.postValue(false);
|
loadInProgress.postValue(false);
|
||||||
|
|
||||||
|
if (runRescanAfterLoad)
|
||||||
|
{
|
||||||
|
runRescanAfterLoad = false;
|
||||||
|
rescan();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Scans for games in the user's configured folders,
|
* Scans for games in the user's configured folders,
|
||||||
* updating the game file cache with the results.
|
* 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()
|
private static void rescan()
|
||||||
{
|
{
|
||||||
if (gameFileCache != null)
|
if (gameFileCache == null)
|
||||||
|
{
|
||||||
|
runRescanAfterLoad = true;
|
||||||
|
}
|
||||||
|
else
|
||||||
{
|
{
|
||||||
String[] gamePaths = GameFileCache.getAllGamePaths();
|
String[] gamePaths = GameFileCache.getAllGamePaths();
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue