fix file::createDirectory + fix Notification warning

This commit is contained in:
HJfod 2022-12-01 22:44:44 +02:00
parent a8cc48f35a
commit a11c526066
3 changed files with 9 additions and 7 deletions

View file

@ -15,8 +15,8 @@ namespace geode::utils::file {
GEODE_DLL Result<> writeString(ghc::filesystem::path const& path, std::string const& data); 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<> writeBinary(ghc::filesystem::path const& path, byte_array const& data);
GEODE_DLL Result<bool> createDirectory(ghc::filesystem::path const& path); GEODE_DLL Result<> createDirectory(ghc::filesystem::path const& path);
GEODE_DLL Result<bool> createDirectoryAll(ghc::filesystem::path const& path); GEODE_DLL Result<> createDirectoryAll(ghc::filesystem::path const& path);
GEODE_DLL Result<std::vector<std::string>> listFiles(std::string const& path); GEODE_DLL Result<std::vector<std::string>> listFiles(std::string const& path);
GEODE_DLL Result<std::vector<std::string>> listFilesRecursively(std::string const& path); GEODE_DLL Result<std::vector<std::string>> listFilesRecursively(std::string const& path);

View file

@ -125,7 +125,7 @@ void Notification::setIcon(cocos2d::CCSprite* icon) {
if (m_icon) { if (m_icon) {
m_icon->removeFromParent(); m_icon->removeFromParent();
} }
if (m_icon = icon) { if ((m_icon = icon)) {
m_bg->addChild(icon); m_bg->addChild(icon);
} }
this->updateLayout(); this->updateLayout();

View file

@ -74,18 +74,20 @@ Result<> utils::file::writeBinary(ghc::filesystem::path const& path, byte_array
return Err("Unable to open file"); return Err("Unable to open file");
} }
Result<bool> utils::file::createDirectory(ghc::filesystem::path const& path) { Result<> utils::file::createDirectory(ghc::filesystem::path const& path) {
try { try {
return Ok(ghc::filesystem::create_directory(path)); ghc::filesystem::create_directory(path);
return Ok();
} }
catch (...) { catch (...) {
return Err("Unable to create directory"); return Err("Unable to create directory");
} }
} }
Result<bool> utils::file::createDirectoryAll(ghc::filesystem::path const& path) { Result<> utils::file::createDirectoryAll(ghc::filesystem::path const& path) {
try { try {
return Ok(ghc::filesystem::create_directories(path)); ghc::filesystem::create_directories(path);
return Ok();
} }
catch (...) { catch (...) {
return Err("Unable to create directories"); return Err("Unable to create directories");