From b982944870342a45900b448456d7c9338b61b68d Mon Sep 17 00:00:00 2001 From: liangfx Date: Wed, 2 Aug 2023 11:49:04 +0800 Subject: [PATCH] attempt to fix #676 --- src/rime/config/config_data.cc | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/src/rime/config/config_data.cc b/src/rime/config/config_data.cc index 0151f94b4..bd497b994 100644 --- a/src/rime/config/config_data.cc +++ b/src/rime/config/config_data.cc @@ -6,6 +6,7 @@ #include #include #include +#include #include #include #include @@ -208,12 +209,22 @@ vector ConfigData::SplitPath(const string& path) { vector keys; auto is_separator = boost::is_any_of("/"); auto trimmed_path = boost::trim_left_copy_if(path, is_separator); - boost::split(keys, trimmed_path, is_separator); + boost::regex re("(?& keys) { - return boost::join(keys, "/"); + std::vector _keys(keys); + for (auto i = 0; i < _keys.size(); i++) { + _keys.at(i) = + boost::regex_replace(_keys.at(i), boost::regex("^/"), "\\\\/"); + } + return boost::join(_keys, "/"); } an ConfigData::Traverse(const string& path) {