GameList: Add ability to exclude/filter paths
This commit is contained in:
parent
172c522a73
commit
b2a5f35d44
|
@ -480,7 +480,7 @@ void GameList::ScanDirectory(const char* path, bool recursive, ProgressCallback*
|
|||
{
|
||||
progress->IncrementProgressValue();
|
||||
|
||||
if (!IsScannableFilename(ffd.FileName) || GetEntryForPath(ffd.FileName.c_str()))
|
||||
if (!IsScannableFilename(ffd.FileName) || IsPathExcluded(ffd.FileName) || GetEntryForPath(ffd.FileName.c_str()))
|
||||
continue;
|
||||
|
||||
const u64 modified_time = ffd.ModificationTime.AsUnixTimestamp();
|
||||
|
@ -592,9 +592,15 @@ bool GameList::GetDatabaseEntryForDisc(CDImage* image, GameDatabaseEntry* entry)
|
|||
return m_database.GetEntryForDisc(image, entry);
|
||||
}
|
||||
|
||||
bool GameList::IsPathExcluded(const std::string& path) const
|
||||
{
|
||||
return (std::find(m_excluded_paths.begin(), m_excluded_paths.end(), path) != m_excluded_paths.end());
|
||||
}
|
||||
|
||||
void GameList::SetSearchDirectoriesFromSettings(SettingsInterface& si)
|
||||
{
|
||||
m_search_directories.clear();
|
||||
m_excluded_paths = si.GetStringList("GameList", "ExcludedPaths");
|
||||
|
||||
std::vector<std::string> dirs = si.GetStringList("GameList", "Paths");
|
||||
for (std::string& dir : dirs)
|
||||
|
|
|
@ -104,6 +104,7 @@ public:
|
|||
const GameListCompatibilityEntry* GetCompatibilityEntryForCode(const std::string& code) const;
|
||||
bool GetDatabaseEntryForCode(const std::string_view& code, GameDatabaseEntry* entry);
|
||||
bool GetDatabaseEntryForDisc(CDImage* image, GameDatabaseEntry* entry);
|
||||
bool IsPathExcluded(const std::string& path) const;
|
||||
|
||||
void SetCacheFilename(std::string filename) { m_cache_filename = std::move(filename); }
|
||||
void SetUserCompatibilityListFilename(std::string filename)
|
||||
|
@ -179,6 +180,7 @@ private:
|
|||
std::unique_ptr<ByteStream> m_cache_write_stream;
|
||||
|
||||
std::vector<DirectoryEntry> m_search_directories;
|
||||
std::vector<std::string> m_excluded_paths;
|
||||
std::string m_cache_filename;
|
||||
std::string m_user_compatibility_list_filename;
|
||||
std::string m_user_game_settings_filename;
|
||||
|
|
Loading…
Reference in New Issue