From 87471927151551a3dda319f11f234c218b7ec18a Mon Sep 17 00:00:00 2001 From: "chunmao.guo" Date: Mon, 27 Mar 2023 19:13:06 +0800 Subject: [PATCH] FIX: [STUDIO-2235] FlushFileBuffers on conf bak Change-Id: I26ddf05c8b7105bb9226930e64a736cdc9be4e4f --- src/libslic3r/utils.cpp | 2 ++ src/slic3r/GUI/GUI_App.cpp | 26 +++++++++++++------------- 2 files changed, 15 insertions(+), 13 deletions(-) diff --git a/src/libslic3r/utils.cpp b/src/libslic3r/utils.cpp index 15bca1f0b..7ab4bf41e 100644 --- a/src/libslic3r/utils.cpp +++ b/src/libslic3r/utils.cpp @@ -897,6 +897,8 @@ CopyFileResult copy_file(const std::string &from, const std::string &to, std::st goto __finished; } + FlushFileBuffers(handledst); + __finished: if (src_wstr) delete[] src_wstr; diff --git a/src/slic3r/GUI/GUI_App.cpp b/src/slic3r/GUI/GUI_App.cpp index f9ad7eaf9..316e07038 100644 --- a/src/slic3r/GUI/GUI_App.cpp +++ b/src/slic3r/GUI/GUI_App.cpp @@ -2050,6 +2050,19 @@ void GUI_App::init_app_config() m_datadir_redefined = true; } + // start log here + std::time_t t = std::time(0); + std::tm * now_time = std::localtime(&t); + std::stringstream buf; + buf << std::put_time(now_time, "debug_%a_%b_%d_%H_%M_%S_"); + buf << get_current_pid() << ".log"; + std::string log_filename = buf.str(); +#if !BBL_RELEASE_TO_PUBLIC + set_log_path_and_level(log_filename, 5); +#else + set_log_path_and_level(log_filename, 3); +#endif + //BBS: remove GCodeViewer as seperate APP logic if (!app_config) app_config = new AppConfig(); @@ -2173,19 +2186,6 @@ bool GUI_App::OnInit() bool GUI_App::on_init_inner() { - //start log here - std::time_t t = std::time(0); - std::tm* now_time = std::localtime(&t); - std::stringstream buf; - buf << std::put_time(now_time, "debug_%a_%b_%d_%H_%M_%S_"); - buf << get_current_pid() << ".log"; - std::string log_filename = buf.str(); -#if !BBL_RELEASE_TO_PUBLIC - set_log_path_and_level(log_filename, 5); -#else - set_log_path_and_level(log_filename, 3); -#endif - // Set initialization of image handlers before any UI actions - See GH issue #7469 wxInitAllImageHandlers(); #ifdef NDEBUG