MCPcopy Create free account
hub / github.com/ObEngine/ObEngine / getDirectoryList

Function getDirectoryList

src/Core/Utils/FileUtils.cpp:30–60  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

28namespace obe::Utils::File
29{
30 std::vector<std::string> getDirectoryList(const std::string& path)
31 {
32 Debug::Log->trace("<FileUtils> Get Directory List at {0}", path);
33 std::vector<std::string> folderList;
34#ifdef _USE_FILESYSTEM_FALLBACK
35 tinydir_dir dir;
36 tinydir_open(&dir, path.c_str());
37
38 while (dir.has_next)
39 {
40 tinydir_file file;
41 tinydir_readfile(&dir, &file);
42 if (file.is_dir && std::string(file.name) != "."
43 && std::string(file.name) != "..")
44 {
45 folderList.push_back(std::string(file.name));
46 }
47 tinydir_next(&dir);
48 }
49 tinydir_close(&dir);
50#else
51 for (auto& p : std::filesystem::directory_iterator(path))
52 {
53 if (std::filesystem::is_directory(p))
54 {
55 folderList.push_back(std::filesystem::path(p.path()).filename().string());
56 }
57 }
58#endif
59 return folderList;
60 }
61
62 std::vector<std::string> getFileList(const std::string& path)
63 {

Callers 1

Loaders.cppFile · 0.85

Calls 8

tinydir_nextFunction · 0.85
tinydir_closeFunction · 0.85
traceMethod · 0.80
stringMethod · 0.80
pathMethod · 0.80
stringClass · 0.50
c_strMethod · 0.45
push_backMethod · 0.45

Tested by

no test coverage detected