From a11c526066ef87e7f73ad0b0b3a52e2cdc0e202b Mon Sep 17 00:00:00 2001 From: HJfod <60038575+HJfod@users.noreply.github.com> Date: Thu, 1 Dec 2022 22:44:44 +0200 Subject: [PATCH] fix file::createDirectory + fix Notification warning --- loader/include/Geode/utils/file.hpp | 4 ++-- loader/src/ui/nodes/Notification.cpp | 2 +- loader/src/utils/file.cpp | 10 ++++++---- 3 files changed, 9 insertions(+), 7 deletions(-) diff --git a/loader/include/Geode/utils/file.hpp b/loader/include/Geode/utils/file.hpp index 5f1a438b..4ed20b8d 100644 --- a/loader/include/Geode/utils/file.hpp +++ b/loader/include/Geode/utils/file.hpp @@ -15,8 +15,8 @@ namespace geode::utils::file { GEODE_DLL Result<> writeString(ghc::filesystem::path const& path, std::string const& data); GEODE_DLL Result<> writeBinary(ghc::filesystem::path const& path, byte_array const& data); - GEODE_DLL Result createDirectory(ghc::filesystem::path const& path); - GEODE_DLL Result createDirectoryAll(ghc::filesystem::path const& path); + GEODE_DLL Result<> createDirectory(ghc::filesystem::path const& path); + GEODE_DLL Result<> createDirectoryAll(ghc::filesystem::path const& path); GEODE_DLL Result> listFiles(std::string const& path); GEODE_DLL Result> listFilesRecursively(std::string const& path); diff --git a/loader/src/ui/nodes/Notification.cpp b/loader/src/ui/nodes/Notification.cpp index 92f6ffeb..5dc9b841 100644 --- a/loader/src/ui/nodes/Notification.cpp +++ b/loader/src/ui/nodes/Notification.cpp @@ -125,7 +125,7 @@ void Notification::setIcon(cocos2d::CCSprite* icon) { if (m_icon) { m_icon->removeFromParent(); } - if (m_icon = icon) { + if ((m_icon = icon)) { m_bg->addChild(icon); } this->updateLayout(); diff --git a/loader/src/utils/file.cpp b/loader/src/utils/file.cpp index 19e2e3af..6f55069f 100644 --- a/loader/src/utils/file.cpp +++ b/loader/src/utils/file.cpp @@ -74,18 +74,20 @@ Result<> utils::file::writeBinary(ghc::filesystem::path const& path, byte_array return Err("Unable to open file"); } -Result utils::file::createDirectory(ghc::filesystem::path const& path) { +Result<> utils::file::createDirectory(ghc::filesystem::path const& path) { try { - return Ok(ghc::filesystem::create_directory(path)); + ghc::filesystem::create_directory(path); + return Ok(); } catch (...) { return Err("Unable to create directory"); } } -Result utils::file::createDirectoryAll(ghc::filesystem::path const& path) { +Result<> utils::file::createDirectoryAll(ghc::filesystem::path const& path) { try { - return Ok(ghc::filesystem::create_directories(path)); + ghc::filesystem::create_directories(path); + return Ok(); } catch (...) { return Err("Unable to create directories");