Merge branch 'altalk' of https://github.com/altalk23/geode into altalk

This commit is contained in:
altalk23 2022-12-02 18:41:08 +03:00
commit 9838f51f07
2 changed files with 8 additions and 12 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<> 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<bool> createDirectory(ghc::filesystem::path const& path);
GEODE_DLL Result<bool> 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>> listFilesRecursively(std::string const& path);

View file

@ -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<bool> 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<bool> 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<std::vector<std::string>> utils::file::listFiles(std::string const& path) {