diff --git a/src/rime/gear/simplifier.cc b/src/rime/gear/simplifier.cc index 073e3f0e7..610919437 100644 --- a/src/rime/gear/simplifier.cc +++ b/src/rime/gear/simplifier.cc @@ -197,7 +197,7 @@ Simplifier::Simplifier(const Ticket& ticket) void Simplifier::Initialize() { initialized_ = true; // no retry path opencc_config_path = path(opencc_config_); - if (opencc_config_path.extension().string() == ".ini") { + if (opencc_config_path.extension().u8string() == ".ini") { LOG(ERROR) << "please upgrade opencc_config to an opencc 1.0 config file."; return; } diff --git a/src/rime/lever/deployment_tasks.cc b/src/rime/lever/deployment_tasks.cc index c141f08e2..05336f27c 100644 --- a/src/rime/lever/deployment_tasks.cc +++ b/src/rime/lever/deployment_tasks.cc @@ -54,8 +54,8 @@ bool DetectModifications::Run(Deployer* deployer) { for (fs::directory_iterator iter(p), end; iter != end; ++iter) { path entry(iter->path()); if (fs::is_regular_file(fs::canonical(entry)) && - entry.extension().string() == ".yaml" && - entry.filename().string() != "user.yaml") { + entry.extension().u8string() == ".yaml" && + entry.filename().u8string() != "user.yaml") { last_modified = (std::max)(last_modified, filesystem::to_time_t(fs::last_write_time(entry))); @@ -458,7 +458,7 @@ bool PrebuildAllSchemas::Run(Deployer* deployer) { for (fs::directory_iterator iter(shared_data_path), end; iter != end; ++iter) { path entry(iter->path()); - if (boost::ends_with(entry.filename().string(), ".schema.yaml")) { + if (boost::ends_with(entry.filename().u8string(), ".schema.yaml")) { the t(new SchemaUpdate(entry)); if (!t->Run(deployer)) success = false; @@ -523,7 +523,7 @@ bool UserDictSync::Run(Deployer* deployer) { } static bool IsCustomizedCopy(const path& file_path) { - auto file_name = file_path.filename().string(); + auto file_name = file_path.filename().u8string(); if (boost::ends_with(file_name, ".yaml") && !boost::ends_with(file_name, ".custom.yaml")) { Config config; @@ -550,7 +550,7 @@ bool BackupConfigFiles::Run(Deployer* deployer) { path entry(iter->path()); if (!fs::is_regular_file(entry)) continue; - auto file_extension = entry.extension().string(); + auto file_extension = entry.extension().u8string(); bool is_yaml_file = file_extension == ".yaml"; bool is_text_file = file_extension == ".txt"; if (!is_yaml_file && !is_text_file) @@ -590,7 +590,7 @@ bool CleanupTrash::Run(Deployer* deployer) { path entry(iter->path()); if (!fs::is_regular_file(entry)) continue; - auto file_name = entry.filename().string(); + auto file_name = entry.filename().u8string(); if (file_name == "rime.log" || boost::ends_with(file_name, ".bin") || boost::ends_with(file_name, ".reverse.kct") || boost::ends_with(file_name, ".userdb.kct.old") || @@ -643,7 +643,7 @@ bool CleanOldLogFiles::Run(Deployer* deployer) { try { // preparing files for (const auto& entry : fs::directory_iterator(dir)) { - const string& file_name(entry.path().filename().string()); + const string& file_name(entry.path().filename().u8string()); if (entry.is_regular_file() && !entry.is_symlink() && boost::starts_with(file_name, app_name) && boost::ends_with(file_name, ".log") && diff --git a/src/rime/lever/switcher_settings.cc b/src/rime/lever/switcher_settings.cc index 6d9763cd2..71ddcddd7 100644 --- a/src/rime/lever/switcher_settings.cc +++ b/src/rime/lever/switcher_settings.cc @@ -54,7 +54,7 @@ void SwitcherSettings::GetAvailableSchemasFromDirectory(const path& dir) { } for (fs::directory_iterator it(dir), end; it != end; ++it) { path file_path(it->path()); - if (boost::ends_with(file_path.string(), ".schema.yaml")) { + if (boost::ends_with(file_path.u8string(), ".schema.yaml")) { Config config; if (config.LoadFromFile(file_path)) { SchemaInfo info; @@ -86,6 +86,7 @@ void SwitcherSettings::GetAvailableSchemasFromDirectory(const path& dir) { } } config.GetString("schema/description", &info.description); + // output path in native encoding. info.file_path = file_path.string(); available_.push_back(info); }