mirror of
https://github.com/SoftFever/OrcaSlicer.git
synced 2025-07-08 07:27:41 -06:00
FIX: cancel remove if log file is opened by other program
Change-Id: I725b03a82af292f9dc81d5f5500773600346c218 (cherry picked from commit f72f4044c2d8a010d1129b4eba1220c20bdf050b) (cherry picked from commit 3a4daa90b526e8970913311fe9bd314b865c92dd)
This commit is contained in:
parent
4d90cc5f80
commit
9e561a3887
1 changed files with 6 additions and 1 deletions
|
@ -1155,7 +1155,12 @@ void GUI_App::post_init()
|
|||
while (files_vec.size() > LOG_FILES_MAX_NUM) {
|
||||
auto full_path = log_folder / boost::filesystem::path(files_vec[files_vec.size() - 1].second);
|
||||
BOOST_LOG_TRIVIAL(info) << "delete log file over " << LOG_FILES_MAX_NUM << ", filename: "<< files_vec[files_vec.size() - 1].second;
|
||||
boost::filesystem::remove(full_path);
|
||||
try {
|
||||
boost::filesystem::remove(full_path);
|
||||
}
|
||||
catch (const std::exception& ex) {
|
||||
BOOST_LOG_TRIVIAL(error) << "failed to delete log file: "<< files_vec[files_vec.size() - 1].second << ". Error: " << ex.what();
|
||||
}
|
||||
files_vec.pop_back();
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue