feat: 整理日志,缓存等目录结构

This commit is contained in:
MistEO
2023-01-13 14:37:31 +08:00
parent 3d7e6f0eeb
commit 95f4b5f54c
15 changed files with 86 additions and 57 deletions

View File

@@ -151,17 +151,15 @@ void asst::AbstractTask::click_return_button()
ProcessTask(*this, { "Return" }).run();
}
bool asst::AbstractTask::save_img(const std::string& dirname)
bool asst::AbstractTask::save_img(const std::filesystem::path& relative_dir)
{
auto image = ctrler()->get_image();
if (image.empty()) {
return false;
}
std::string stem = utils::get_format_time();
stem = utils::string_replace_all(stem, { { ":", "-" }, { " ", "_" } });
std::filesystem::create_directories(dirname);
std::string full_path = dirname + stem + "_raw.png";
Log.trace("Save image", full_path);
return asst::imwrite(full_path, image);
auto relative_path = relative_dir / (stem + "_raw.png");
Log.trace("Save image", relative_path);
return asst::imwrite(relative_path, image);
}