mirror of
https://github.com/hrydgard/ppsspp.git
synced 2024-11-23 13:30:02 +00:00
Create vital directories on Android storage permission grant. Should help #11020
This commit is contained in:
parent
f82c3a3b18
commit
3976b03bcd
@ -564,10 +564,6 @@ void InitSysDirectories() {
|
||||
File::CreateDir(g_Config.memStickDirectory + "PSP/GAME");
|
||||
File::CreateDir(g_Config.memStickDirectory + "PSP/SAVEDATA");
|
||||
File::CreateDir(g_Config.memStickDirectory + "PSP/PPSSPP_STATE");
|
||||
#ifdef ANDROID
|
||||
// Avoid media scanners in PPSSPP_STATE directory
|
||||
File::CreateEmptyFile(g_Config.memStickDirectory + "PSP/PPSSPP_STATE/.nomedia");
|
||||
#endif
|
||||
|
||||
if (g_Config.currentDirectory.empty()) {
|
||||
g_Config.currentDirectory = GetSysDirectory(DIRECTORY_GAME);
|
||||
|
@ -326,6 +326,19 @@ static void PostLoadConfig() {
|
||||
i18nrepo.LoadIni(g_Config.sLanguageIni, langOverridePath);
|
||||
}
|
||||
|
||||
void CreateDirectoriesAndroid() {
|
||||
// On Android, create a PSP directory tree in the external_dir,
|
||||
// to hopefully reduce confusion a bit.
|
||||
ILOG("Creating %s", (g_Config.memStickDirectory + "PSP").c_str());
|
||||
File::CreateDir((g_Config.memStickDirectory + "PSP").c_str());
|
||||
File::CreateDir((g_Config.memStickDirectory + "PSP/SAVEDATA").c_str());
|
||||
File::CreateDir((g_Config.memStickDirectory + "PSP/PPSSPP_STATE").c_str());
|
||||
File::CreateDir((g_Config.memStickDirectory + "PSP/GAME").c_str());
|
||||
// Avoid media scanners in PPSSPP_STATE and SAVEDATA directories
|
||||
File::CreateEmptyFile(g_Config.memStickDirectory + "PSP/PPSSPP_STATE/.nomedia");
|
||||
File::CreateEmptyFile(g_Config.memStickDirectory + "PSP/SAVEDATA/.nomedia");
|
||||
}
|
||||
|
||||
void NativeInit(int argc, const char *argv[], const char *savegame_dir, const char *external_dir, const char *cache_dir, bool fs) {
|
||||
net::Init(); // This needs to happen before we load the config. So on Windows we also run it in Main. It's fine to call multiple times.
|
||||
|
||||
@ -409,17 +422,9 @@ void NativeInit(int argc, const char *argv[], const char *savegame_dir, const ch
|
||||
LogManager *logman = LogManager::GetInstance();
|
||||
|
||||
#ifdef __ANDROID__
|
||||
// TODO: This is also done elsewhere. Remove?
|
||||
// On Android, create a PSP directory tree in the external_dir,
|
||||
// to hopefully reduce confusion a bit.
|
||||
ILOG("Creating %s", (g_Config.memStickDirectory + "PSP").c_str());
|
||||
File::CreateDir((g_Config.memStickDirectory + "PSP").c_str());
|
||||
File::CreateDir((g_Config.memStickDirectory + "PSP/SAVEDATA").c_str());
|
||||
File::CreateDir((g_Config.memStickDirectory + "PSP/GAME").c_str());
|
||||
CreateDirectoriesAndroid();
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
const char *fileToLog = 0;
|
||||
const char *stateToLoad = 0;
|
||||
|
||||
@ -963,10 +968,12 @@ void HandleGlobalMessage(const std::string &msg, const std::string &value) {
|
||||
osm.Show(sy->T("WARNING: Battery save mode is on"), 2.0f, 0xFFFFFF, -1, true, "core_powerSaving");
|
||||
#endif
|
||||
}
|
||||
|
||||
Core_SetPowerSaving(value != "false");
|
||||
}
|
||||
if (msg == "permission_granted" && value == "storage") {
|
||||
#ifdef __ANDROID__
|
||||
CreateDirectoriesAndroid();
|
||||
#endif
|
||||
// We must have failed to load the config before, so load it now to avoid overwriting the old config
|
||||
// with a freshly generated one.
|
||||
ILOG("Reloading config after storage permission grant.");
|
||||
|
Loading…
Reference in New Issue
Block a user