mirror of
https://github.com/geode-sdk/geode.git
synced 2024-11-23 07:57:51 -05:00
add file::readDirectory as a sane alternative to file::listFiles
This commit is contained in:
parent
fcfbd0136b
commit
9f60091fbb
2 changed files with 10 additions and 0 deletions
|
@ -29,9 +29,13 @@ namespace geode::utils::file {
|
||||||
|
|
||||||
GEODE_DLL Result<> createDirectory(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<> createDirectoryAll(ghc::filesystem::path const& path);
|
||||||
|
[[deprecated("Use file::readDirectory")]]
|
||||||
GEODE_DLL Result<std::vector<ghc::filesystem::path>> listFiles(
|
GEODE_DLL Result<std::vector<ghc::filesystem::path>> listFiles(
|
||||||
ghc::filesystem::path const& path, bool recursive = false
|
ghc::filesystem::path const& path, bool recursive = false
|
||||||
);
|
);
|
||||||
|
GEODE_DLL Result<std::vector<ghc::filesystem::path>> readDirectory(
|
||||||
|
ghc::filesystem::path const& path, bool recursive = false
|
||||||
|
);
|
||||||
|
|
||||||
class Unzip;
|
class Unzip;
|
||||||
|
|
||||||
|
|
|
@ -116,6 +116,12 @@ Result<> utils::file::createDirectoryAll(ghc::filesystem::path const& path) {
|
||||||
|
|
||||||
Result<std::vector<ghc::filesystem::path>> utils::file::listFiles(
|
Result<std::vector<ghc::filesystem::path>> utils::file::listFiles(
|
||||||
ghc::filesystem::path const& path, bool recursive
|
ghc::filesystem::path const& path, bool recursive
|
||||||
|
) {
|
||||||
|
return file::readDirectory(path, recursive);
|
||||||
|
}
|
||||||
|
|
||||||
|
Result<std::vector<ghc::filesystem::path>> utils::file::readDirectory(
|
||||||
|
ghc::filesystem::path const& path, bool recursive
|
||||||
) {
|
) {
|
||||||
if (!ghc::filesystem::exists(path)) {
|
if (!ghc::filesystem::exists(path)) {
|
||||||
return Err("Directory does not exist");
|
return Err("Directory does not exist");
|
||||||
|
|
Loading…
Reference in a new issue