FIX: fix a crash issue when copy failed

Change-Id: Ie0cd4676d9f31213c80a4a9a7f5c836c58a53120
This commit is contained in:
salt.wei 2022-11-22 21:22:37 +08:00 committed by Lane.Wei
parent de8db2a89c
commit 93a0d3a4ca
2 changed files with 5 additions and 1 deletions

View file

@ -818,7 +818,7 @@ CopyFileResult copy_file_inner(const std::string& from, const std::string& to, s
if (ec) {
error_message = ec.message();
BOOST_LOG_TRIVIAL(error) << boost::format("###copy_file from %1% to %2% failed, error: %3% ")
%source.string() %target.string() << error_message;
%source.string() %target.string() % error_message;
return FAIL_COPY_FILE;
}
ec.clear();

View file

@ -2459,6 +2459,10 @@ void GUI_App::copy_network_if_available()
#endif
BOOST_LOG_TRIVIAL(info) << __FUNCTION__<< ": checking network_library " << network_library << ", player_library " << player_library;
if (!boost::filesystem::exists(plugin_folder)) {
BOOST_LOG_TRIVIAL(info)<< __FUNCTION__ << ": create directory "<<plugin_folder.string();
boost::filesystem::create_directory(plugin_folder);
}
std::string error_message;
if (boost::filesystem::exists(network_library)) {
CopyFileResult cfr = copy_file(network_library, network_library_dst, error_message, false);