MCPcopy Create free account
hub / github.com/WinMerge/winmerge / LoadAllFileFilters

Method LoadAllFileFilters

Src/FileFilterHelper.cpp:692–722  ·  view source on GitHub ↗

* @brief Load any known file filters * @todo Preserve filter selection? How? */

Source from the content-addressed store, hash-verified

690 * @todo Preserve filter selection? How?
691 */
692void FileFilterHelper::LoadAllFileFilters()
693{
694 // First delete existing filters
695 m_fileFilterMgr->DeleteAllFilters();
696
697 std::vector<String> folders;
698 auto addUnique = [&](const String& path)
699 {
700 if (path.empty())
701 return;
702 for (const auto& f : folders)
703 {
704 if (strutils::compare_nocase(f, path) == 0)
705 return;
706 }
707 folders.push_back(path);
708 };
709 // Program application directory
710 m_sGlobalFilterPath = paths::ConcatPath(env::GetProgPath(), _T("Filters"));
711 addUnique(m_sGlobalFilterPath);
712 addUnique(paths::ConcatPath(env::GetAppDataPath(), _T("WinMerge\\Filters")));
713 addUnique(paths::ConcatPath(env::GetMyDocuments(), _T("WinMerge\\Filters")));
714 if (!m_sUserSelFilterPath.empty())
715 addUnique(m_sUserSelFilterPath);
716
717 String pattern(_T("*"));
718 pattern += FileFilterExt;
719
720 for (const auto& folder : folders)
721 LoadFileFilterDirPattern(folder, pattern);
722}
723
724/**
725 * @brief Return path to global filters (& create if needed), or empty if cannot create

Callers 3

InitializeFileFiltersMethod · 0.80
SetUpMethod · 0.80

Calls 7

ConcatPathFunction · 0.85
GetProgPathFunction · 0.85
GetAppDataPathFunction · 0.85
GetMyDocumentsFunction · 0.85
DeleteAllFiltersMethod · 0.80
compare_nocaseFunction · 0.50
emptyMethod · 0.45

Tested by 1

SetUpMethod · 0.64