mirror of
https://github.com/MaaAssistantArknights/MaaAssistantArknights.git
synced 2026-07-16 09:50:40 +08:00
fix: Debug图片保存目录 (#15250)
This commit is contained in:
@@ -81,6 +81,11 @@ inline bool save_debug_image(
|
||||
static std::mutex s_mutex;
|
||||
|
||||
auto norm_dir = relative_dir.lexically_normal();
|
||||
const auto& base_dir = UserDir.get();
|
||||
auto res = std::mismatch(base_dir.begin(), base_dir.end(), norm_dir.begin());
|
||||
if (norm_dir.is_relative() && res.first != base_dir.end()) {
|
||||
norm_dir = base_dir / norm_dir;
|
||||
}
|
||||
|
||||
if (auto_clean) {
|
||||
std::lock_guard<std::mutex> lock(s_mutex);
|
||||
|
||||
@@ -19,12 +19,13 @@ public:
|
||||
|
||||
const std::filesystem::path& get() const noexcept { return dir_; }
|
||||
|
||||
bool set(std::filesystem::path dir)
|
||||
bool set(const std::filesystem::path& dir)
|
||||
{
|
||||
if (!std::filesystem::exists(dir) || !std::filesystem::is_directory(dir)) {
|
||||
auto norm_dir = dir.lexically_normal();
|
||||
if (!std::filesystem::exists(norm_dir) || !std::filesystem::is_directory(norm_dir)) {
|
||||
return false;
|
||||
}
|
||||
dir_ = std::move(dir);
|
||||
dir_ = std::move(norm_dir);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user