mirror of
https://github.com/RetroDECK/ES-DE.git
synced 2025-03-06 14:27:43 +00:00
(Android) Directories for corrupt themes are now automatically removed when the theme downloader is started
This commit is contained in:
parent
6c6dc82ef6
commit
f0ea55b9f2
|
@ -1100,6 +1100,9 @@ void GuiThemeDownloader::setupFullscreenViewer()
|
|||
void GuiThemeDownloader::update(int deltaTime)
|
||||
{
|
||||
if (!mAttemptedFetch) {
|
||||
#if defined(__ANDROID__)
|
||||
removeDisabledRepositories();
|
||||
#endif
|
||||
// We need to run this here instead of from the constructor so that GuiMsgBox will be
|
||||
// on top of the GUI stack if it needs to be displayed.
|
||||
mAttemptedFetch = true;
|
||||
|
@ -1375,6 +1378,32 @@ std::vector<HelpPrompt> GuiThemeDownloader::getHelpPrompts()
|
|||
return prompts;
|
||||
}
|
||||
|
||||
void GuiThemeDownloader::removeDisabledRepositories()
|
||||
{
|
||||
const Utils::FileSystem::StringList& dirContent {
|
||||
Utils::FileSystem::getDirContent(mThemeDirectory)};
|
||||
|
||||
std::vector<std::string> disabledDirs;
|
||||
|
||||
for (auto& directory : dirContent) {
|
||||
if (Utils::FileSystem::isRegularFile(directory))
|
||||
continue;
|
||||
if (Utils::FileSystem::getFileName(directory).length() > 9) {
|
||||
if (directory.substr(directory.length() - 9, 9) == "_DISABLED")
|
||||
disabledDirs.emplace_back(directory);
|
||||
}
|
||||
}
|
||||
|
||||
if (disabledDirs.empty())
|
||||
return;
|
||||
|
||||
for (auto& directory : disabledDirs) {
|
||||
LOG(LogInfo) << "GuiThemeDownloader: Removing disabled theme directory \"" << directory
|
||||
<< "\"";
|
||||
Utils::FileSystem::removeDirectory(directory, true);
|
||||
}
|
||||
}
|
||||
|
||||
bool GuiThemeDownloader::fetchThemesList()
|
||||
{
|
||||
const std::string repositoryName {"themes-list"};
|
||||
|
|
|
@ -90,6 +90,7 @@ private:
|
|||
}
|
||||
};
|
||||
|
||||
void removeDisabledRepositories();
|
||||
bool fetchThemesList();
|
||||
bool fetchRepository(const std::string& repositoryName, bool allowReset = false);
|
||||
bool cloneRepository(const std::string& repositoryName, const std::string& url);
|
||||
|
|
Loading…
Reference in a new issue