mirror of
https://github.com/OrcaSlicer/OrcaSlicer.git
synced 2026-09-10 02:37:04 +00:00
fix: add logging to prune_tmps
This commit is contained in:
@@ -374,10 +374,18 @@ bool PresetUpdater::priv::extract_file(const fs::path &source_path, const fs::pa
|
|||||||
// Remove leftover paritally downloaded files, if any.
|
// Remove leftover paritally downloaded files, if any.
|
||||||
void PresetUpdater::priv::prune_tmps() const
|
void PresetUpdater::priv::prune_tmps() const
|
||||||
{
|
{
|
||||||
for (auto &dir_entry : boost::filesystem::directory_iterator(cache_path))
|
boost::system::error_code ec;
|
||||||
|
auto dir_it = boost::filesystem::directory_iterator(cache_path, ec);
|
||||||
|
if (ec) {
|
||||||
|
BOOST_LOG_TRIVIAL(warning) << "[Orca Updater]failed to list cache dir " << cache_path.string() << ": " << ec.message();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
for (auto &dir_entry : dir_it)
|
||||||
if (is_plain_file(dir_entry) && dir_entry.path().extension() == TMP_EXTENSION) {
|
if (is_plain_file(dir_entry) && dir_entry.path().extension() == TMP_EXTENSION) {
|
||||||
BOOST_LOG_TRIVIAL(debug) << "[Orca Updater]remove old cached files: " << dir_entry.path().string();
|
BOOST_LOG_TRIVIAL(debug) << "[Orca Updater]remove old cached files: " << dir_entry.path().string();
|
||||||
fs::remove(dir_entry.path());
|
fs::remove(dir_entry.path(), ec);
|
||||||
|
if (ec)
|
||||||
|
BOOST_LOG_TRIVIAL(warning) << "[Orca Updater]failed to remove " << dir_entry.path().string() << ": " << ec.message();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user