From cdc6c080b7115757c546841fc2cca2ec96ab2f2f Mon Sep 17 00:00:00 2001 From: Shawn Sun Date: Thu, 11 May 2023 03:05:59 +0800 Subject: [PATCH] fix(avatarcachemanager): avatar saved at wrong path in set_avatar() m_save_path is empty & ::load() never called when cache folder does not exist. --- src/MaaCore/Config/ResourceLoader.cpp | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/src/MaaCore/Config/ResourceLoader.cpp b/src/MaaCore/Config/ResourceLoader.cpp index 36b992c43d..8fa5306eb4 100644 --- a/src/MaaCore/Config/ResourceLoader.cpp +++ b/src/MaaCore/Config/ResourceLoader.cpp @@ -109,12 +109,13 @@ bool asst::ResourceLoader::load(const std::filesystem::path& path) } \ } -#define LoadCacheWithoutRet(Config, Dir) \ - { \ - auto full_path = UserDir.get() / "cache"_p / Dir; \ - if (std::filesystem::exists(full_path)) { \ - SingletonHolder::get_instance().load(full_path); \ - } \ +#define LoadCacheWithoutRet(Config, Dir) \ + { \ + auto full_path = UserDir.get() / "cache"_p / Dir; \ + if (!std::filesystem::exists(full_path)) { \ + std::filesystem::create_directories(full_path); \ + } \ + SingletonHolder::get_instance().load(full_path); \ } LogTraceFunction;