From c5faa36f438621e8229a348f86f37b238e21037d Mon Sep 17 00:00:00 2001 From: Connor McLaughlin Date: Fri, 24 Jan 2020 14:51:12 +1000 Subject: [PATCH] GameList: Add function to query whether database exists --- src/core/game_list.cpp | 5 +++++ src/core/game_list.h | 4 +++- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/src/core/game_list.cpp b/src/core/game_list.cpp index 56c41b81c..2017afa5d 100644 --- a/src/core/game_list.cpp +++ b/src/core/game_list.cpp @@ -689,6 +689,11 @@ void GameList::SetSearchDirectoriesFromSettings(SettingsInterface& si) m_search_directories.push_back({std::move(dir), true}); } +bool GameList::IsDatabasePresent() const +{ + return FileSystem::FileExists(m_database_filename.c_str()); +} + void GameList::Refresh(bool invalidate_cache, bool invalidate_database) { if (invalidate_cache) diff --git a/src/core/game_list.h b/src/core/game_list.h index cd66b26e1..d80dd8ecf 100644 --- a/src/core/game_list.h +++ b/src/core/game_list.h @@ -65,8 +65,10 @@ public: void SetCacheFilename(std::string filename) { m_cache_filename = std::move(filename); } void SetDatabaseFilename(std::string filename) { m_database_filename = std::move(filename); } - void SetSearchDirectoriesFromSettings(SettingsInterface& si); + + bool IsDatabasePresent() const; + void AddDirectory(std::string path, bool recursive); void Refresh(bool invalidate_cache, bool invalidate_database);