Minor tweak: avoid exceptions
This commit is contained in:
parent
587fab285c
commit
e76ca8febf
3 changed files with 18 additions and 7 deletions
|
@ -28,6 +28,7 @@
|
|||
"support_print_all":false,
|
||||
"support_print_without_sd":false,
|
||||
"support_flow_calibration":true,
|
||||
"support_build_plate_marker_detect":false,
|
||||
"support_lidar_calibration":false,
|
||||
"support_ai_monitoring":false,
|
||||
"support_first_layer_inspect":false,
|
||||
|
|
|
@ -28,6 +28,7 @@
|
|||
"support_print_all":false,
|
||||
"support_print_without_sd":false,
|
||||
"support_flow_calibration":true,
|
||||
"support_build_plate_marker_detect":false,
|
||||
"support_lidar_calibration":false,
|
||||
"support_ai_monitoring":false,
|
||||
"support_first_layer_inspect":false,
|
||||
|
|
|
@ -942,12 +942,18 @@ void PresetUpdater::priv::sync_printer_config(std::string http_url)
|
|||
auto cache_folder = data_dir_path / "ota" / "printers";
|
||||
|
||||
try {
|
||||
Slic3r::load_string_file(config_folder / "version.txt", curr_version);
|
||||
boost::algorithm::trim(curr_version);
|
||||
auto version_file = config_folder / "version.txt";
|
||||
if (fs::exists(version_file)) {
|
||||
Slic3r::load_string_file(version_file, curr_version);
|
||||
boost::algorithm::trim(curr_version);
|
||||
}
|
||||
} catch (...) {}
|
||||
try {
|
||||
Slic3r::load_string_file(cache_folder / "version.txt", cached_version);
|
||||
boost::algorithm::trim(cached_version);
|
||||
auto version_file = cache_folder / "version.txt";
|
||||
if (fs::exists(version_file)) {
|
||||
Slic3r::load_string_file(version_file, cached_version);
|
||||
boost::algorithm::trim(cached_version);
|
||||
}
|
||||
} catch (...) {}
|
||||
if (!cached_version.empty()) {
|
||||
bool need_delete_cache = false;
|
||||
|
@ -980,9 +986,12 @@ void PresetUpdater::priv::sync_printer_config(std::string http_url)
|
|||
|
||||
bool result = false;
|
||||
try {
|
||||
Slic3r::load_string_file(cache_folder / "version.txt", cached_version);
|
||||
boost::algorithm::trim(cached_version);
|
||||
result = true;
|
||||
auto version_file = cache_folder / "version.txt";
|
||||
if (fs::exists(version_file)) {
|
||||
Slic3r::load_string_file(version_file, cached_version);
|
||||
boost::algorithm::trim(cached_version);
|
||||
result = true;
|
||||
}
|
||||
} catch (...) {}
|
||||
if (result) {
|
||||
BOOST_LOG_TRIVIAL(info) << format("[Orca Updater] found new printer config: %1%, prompt to update", cached_version);
|
||||
|
|
Loading…
Reference in a new issue