From 402137c647f3cd229ccf0f716e63a59c441fc6fa Mon Sep 17 00:00:00 2001 From: Bambooin Date: Tue, 22 Aug 2023 05:42:33 +0800 Subject: [PATCH] Fix build error of deprecated api (#697) * fix: fix build error of deprecated api Build failed on Trime procject with boost 1.83.0 This error begins on upstream librime(0d12d9037ae50346387fcce400be64d57fc41f92) and boost 1.83.0 /trime/app/src/main/jni/librime/src/rime/lever/customizer.cc:91:11: error: 'copy_file' is deprecated: Use copy_options instead of copy_option [-Werror,-Wdeprecated-declarations] * require boost minimum 1.74 --------- Co-authored-by: Qijia Liu --- CMakeLists.txt | 2 +- src/rime/lever/customizer.cc | 2 +- src/rime/lever/deployment_tasks.cc | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 6f8d4d4515..a4117aed61 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -66,7 +66,7 @@ else() set(BOOST_COMPONENTS ${BOOST_COMPONENTS} signals) endif() -find_package(Boost 1.46.0 REQUIRED COMPONENTS ${BOOST_COMPONENTS}) +find_package(Boost 1.74.0 REQUIRED COMPONENTS ${BOOST_COMPONENTS}) if(Boost_FOUND) include_directories(${Boost_INCLUDE_DIRS}) link_directories(${Boost_LIBRARY_DIRS}) diff --git a/src/rime/lever/customizer.cc b/src/rime/lever/customizer.cc index e5021e84fe..6b5ce2375c 100644 --- a/src/rime/lever/customizer.cc +++ b/src/rime/lever/customizer.cc @@ -89,7 +89,7 @@ bool Customizer::UpdateConfigFile() { if (redistribute || (is_dirty && !missing_original_copy)) { try { fs::copy_file(source_path_, dest_path_, - fs::copy_option::overwrite_if_exists); + fs::copy_options::overwrite_existing); } catch (...) { LOG(ERROR) << "Error copying config file '" << source_path_.string() << "' to user directory."; diff --git a/src/rime/lever/deployment_tasks.cc b/src/rime/lever/deployment_tasks.cc index b94a2a13a5..fb26fa5854 100644 --- a/src/rime/lever/deployment_tasks.cc +++ b/src/rime/lever/deployment_tasks.cc @@ -562,7 +562,7 @@ bool BackupConfigFiles::Run(Deployer* deployer) { continue; } boost::system::error_code ec; - fs::copy_file(entry, backup, fs::copy_option::overwrite_if_exists, ec); + fs::copy_file(entry, backup, fs::copy_options::overwrite_existing, ec); if (ec) { LOG(ERROR) << "error backing up file " << backup.string(); ++failure;