Manager+Test: Move exclude paths and system directories to config

This commit is contained in:
Riyyi
2022-02-08 23:39:12 +01:00
parent da91c4b3fd
commit 16947b93e2
5 changed files with 19 additions and 49 deletions
+8 -8
View File
@@ -353,19 +353,19 @@ void Dotfile::forEachDotfile(const std::vector<std::string>& targets, const std:
bool Dotfile::filter(const std::filesystem::path& path)
{
for (auto& excludePath : m_excludePaths) {
if (excludePath.type == ExcludeType::File) {
if (path.string() == Config::the().workingDirectory() / excludePath.path) {
for (auto& excludePath : Config::the().excludePaths()) {
if (excludePath.second == "file") {
if (path.string() == Config::the().workingDirectory() / excludePath.first) {
return true;
}
}
else if (excludePath.type == ExcludeType::Directory) {
if (path.string().find(Config::the().workingDirectory() / excludePath.path) == 0) {
else if (excludePath.second == "directory") {
if (path.string().find(Config::the().workingDirectory() / excludePath.first) == 0) {
return true;
}
}
else if (excludePath.type == ExcludeType::EndsWith) {
if (path.string().find(excludePath.path) == path.string().size() - excludePath.path.size()) {
else if (excludePath.second == "endsWith") {
if (path.string().find(excludePath.first) == path.string().size() - excludePath.first.size()) {
return true;
}
}
@@ -387,7 +387,7 @@ bool Dotfile::include(const std::filesystem::path& path, const std::vector<std::
bool Dotfile::isSystemTarget(const std::string& target)
{
for (const auto& systemDirectory : m_systemDirectories) {
for (const auto& systemDirectory : Config::the().systemDirectories()) {
if (target.find(systemDirectory) == 0) {
return true;