diff --git a/loader/include/Geode/utils/file.hpp b/loader/include/Geode/utils/file.hpp index 8089a072..a5452b8e 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/utils/file.cpp b/loader/src/utils/file.cpp index 63456092..1f38c379 100644 --- a/loader/src/utils/file.cpp +++ b/loader/src/utils/file.cpp @@ -74,26 +74,22 @@ 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 { - if (ghc::filesystem::create_directory(path)) { - return Ok(); - } + return Ok(ghc::filesystem::create_directory(path)); } catch (...) { + return Err("Unable to create directory"); } - 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 { - if (ghc::filesystem::create_directories(path)) { - return Ok(); - } + return Ok(ghc::filesystem::create_directories(path)); } catch (...) { + return Err("Unable to create directories"); } - return Err("Unable to create directories"); } Result> utils::file::listFiles(std::string const& path) {