| 117 | } |
| 118 | |
| 119 | bool NativeFilesystem::GetDirectoryContent(std::string_view path, std::vector<DirectoryTree::Entry>& entries) const { |
| 120 | std::string p = ToString(path); |
| 121 | |
| 122 | Platform::Directory dir(p); |
| 123 | if (!dir) { |
| 124 | Output::Debug("Error opening dir {}: {}", p, ::strerror(errno)); |
| 125 | return false; |
| 126 | } |
| 127 | |
| 128 | while (dir.Read()) { |
| 129 | const auto& name = dir.GetEntryName(); |
| 130 | Platform::FileType type = dir.GetEntryType(); |
| 131 | |
| 132 | if (name == "." || name == "..") { |
| 133 | continue; |
| 134 | } |
| 135 | |
| 136 | bool is_directory = false; |
| 137 | if (type == Platform::FileType::Directory) { |
| 138 | is_directory = true; |
| 139 | } else if (type == Platform::FileType::Unknown) { |
| 140 | is_directory = IsDirectory(name, true); |
| 141 | } |
| 142 | |
| 143 | entries.emplace_back( |
| 144 | name, |
| 145 | is_directory ? DirectoryTree::FileType::Directory : DirectoryTree::FileType::Regular); |
| 146 | } |
| 147 | |
| 148 | return true; |
| 149 | } |
| 150 | |
| 151 | bool NativeFilesystem::MakeDirectory(std::string_view path, bool follow_symlinks) const { |
| 152 | return Platform::File(ToString(path)).MakeDirectory(follow_symlinks); |
nothing calls this directly
no test coverage detected