mirror of
https://github.com/ondra-novak/gates_of_skeldal.git
synced 2025-07-05 06:00:33 -04:00
console portal jump
This commit is contained in:
parent
ce3e42f66b
commit
93caf370e4
4 changed files with 106 additions and 9 deletions
|
@ -111,17 +111,21 @@ int list_files(const char *directory, int type, LIST_FILES_CALLBACK cb, void *ct
|
|||
while (iter != std::filesystem::directory_iterator()) {
|
||||
int r = 0;
|
||||
const auto &entry = *iter;
|
||||
const char *name;
|
||||
if (type & file_type_just_name) name = entry.path().filename().c_str();
|
||||
else name = entry.path().filename().c_str();
|
||||
if (entry.is_regular_file(ec) && (type & file_type_normal)) {
|
||||
r = cb(entry.path().c_str(), file_type_normal, entry.file_size(ec), ctx);
|
||||
r = cb(name, file_type_normal, entry.file_size(ec), ctx);
|
||||
} else if (entry.is_directory(ec)) {
|
||||
int dot = entry.path().filename() == "." || entry.path().filename() == "..";
|
||||
if (!dot && (type & file_type_directory)) {
|
||||
r = cb(entry.path().c_str(), file_type_directory, 0, ctx);
|
||||
r = cb(name, file_type_directory, 0, ctx);
|
||||
} else if (dot & (type & file_type_dot)) {
|
||||
r = cb(entry.path().c_str(), file_type_dot, 0, ctx);
|
||||
r = cb(name, file_type_dot, 0, ctx);
|
||||
}
|
||||
}
|
||||
if (r) return r;
|
||||
++iter;
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue