mirror of
https://github.com/MihailRis/voxelcore.git
synced 2026-10-08 04:21:50 +00:00
fix ZipFileDevice::list for root path
This commit is contained in:
parent
bd614c5f2e
commit
b52cc1aea0
1 changed files with 13 additions and 4 deletions
|
|
@ -293,10 +293,19 @@ private:
|
||||||
|
|
||||||
std::unique_ptr<PathsGenerator> ZipFileDevice::list(std::string_view path) {
|
std::unique_ptr<PathsGenerator> ZipFileDevice::list(std::string_view path) {
|
||||||
std::vector<std::string> names;
|
std::vector<std::string> names;
|
||||||
auto folder = std::string(path) + "/";
|
if (path.empty()) {
|
||||||
size_t folderLen = folder.length();
|
for (const auto& [name, entry] : entries) {
|
||||||
for (const auto& [name, entry] : entries) {
|
if (name.find('/') == std::string::npos) {
|
||||||
if (name.find(folder) == 0) {
|
names.push_back(name);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
auto folder = std::string(path) + "/";
|
||||||
|
size_t folderLen = folder.length();
|
||||||
|
for (const auto& [name, entry] : entries) {
|
||||||
|
if (name.find(folder) != 0) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
size_t pos = name.find('/', folderLen);
|
size_t pos = name.find('/', folderLen);
|
||||||
if (pos == std::string::npos) {
|
if (pos == std::string::npos) {
|
||||||
names.push_back(name.substr(folderLen, pos - folderLen));
|
names.push_back(name.substr(folderLen, pos - folderLen));
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue