mirror of
https://github.com/geode-sdk/geode.git
synced 2024-11-14 19:15:05 -05:00
Merge branch 'altalk' of https://github.com/altalk23/geode into altalk
This commit is contained in:
commit
9838f51f07
2 changed files with 8 additions and 12 deletions
|
@ -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<> createDirectory(ghc::filesystem::path const& path);
|
GEODE_DLL Result<bool> createDirectory(ghc::filesystem::path const& path);
|
||||||
GEODE_DLL Result<> createDirectoryAll(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>> 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);
|
||||||
|
|
||||||
|
|
|
@ -74,26 +74,22 @@ Result<> utils::file::writeBinary(ghc::filesystem::path const& path, byte_array
|
||||||
return Err("Unable to open file");
|
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 {
|
try {
|
||||||
if (ghc::filesystem::create_directory(path)) {
|
return Ok(ghc::filesystem::create_directory(path));
|
||||||
return Ok();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
catch (...) {
|
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 {
|
try {
|
||||||
if (ghc::filesystem::create_directories(path)) {
|
return Ok(ghc::filesystem::create_directories(path));
|
||||||
return Ok();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
catch (...) {
|
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) {
|
Result<std::vector<std::string>> utils::file::listFiles(std::string const& path) {
|
||||||
|
|
Loading…
Reference in a new issue