(Android) Added creation of a .nomedia file in the ROM directory

This commit is contained in:
Leon Styhre 2024-02-11 22:58:32 +01:00
parent be0851a562
commit 8e8f17c1d1

View file

@ -504,6 +504,7 @@ void applicationLoop()
#if defined(__ANDROID__)
// Prevent that button presses get registered immediately when entering the
// foreground (which most commonly mean we're returning from a game).
// Also perform some other tasks on resume such as resetting timers.
if (event.type == SDL_APP_WILLENTERFOREGROUND) {
blockInput = true;
inputBlockTime = 0;
@ -1076,6 +1077,18 @@ int main(int argc, char* argv[])
}
}
#if defined(__ANDROID__)
if (!Utils::FileSystem::exists(FileData::getROMDirectory() + ".nomedia")) {
LOG(LogInfo) << "Creating \"no media\" file \""
<< FileData::getROMDirectory() + ".nomedia"
<< "\"...";
Utils::FileSystem::createEmptyFile(FileData::getROMDirectory() + ".nomedia");
if (!Utils::FileSystem::exists(FileData::getROMDirectory() + ".nomedia")) {
LOG(LogWarning) << "Couldn't create file, permission problems?";
}
}
#endif
// Generate controller events since we're done loading.
SDL_GameControllerEventState(SDL_ENABLE);