From 413a36a914d5ccab38feb3cab93db8f2b1352363 Mon Sep 17 00:00:00 2001 From: vaxerski <43317083+vaxerski@users.noreply.github.com> Date: Fri, 12 May 2023 01:15:32 +0100 Subject: [PATCH] workspacerules: overwrite on existing --- src/config/ConfigManager.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/config/ConfigManager.cpp b/src/config/ConfigManager.cpp index 833e17e4..3b558540 100644 --- a/src/config/ConfigManager.cpp +++ b/src/config/ConfigManager.cpp @@ -1125,7 +1125,12 @@ void CConfigManager::handleWorkspaceRules(const std::string& command, const std: wsRule.workspaceId = id; wsRule.workspaceName = name; - m_dWorkspaceRules.emplace_back(wsRule); + const auto IT = std::find_if(m_dWorkspaceRules.begin(), m_dWorkspaceRules.end(), [&](const auto& other) { return other.workspaceString == wsRule.workspaceString; }); + + if (IT == m_dWorkspaceRules.end()) + m_dWorkspaceRules.emplace_back(wsRule); + else + *IT = wsRule; } void CConfigManager::handleSubmap(const std::string& command, const std::string& submap) {