-
Notifications
You must be signed in to change notification settings - Fork 0
108 - Add directory listing support #3
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
Don't merge yet (label isnt on this repo) |
@@ -19,6 +19,10 @@ namespace VpkParser { | |||
const std::function<std::vector<std::byte>(uint16_t archive, uint32_t offset, uint32_t size)>& readFromArchive | |||
) const; | |||
|
|||
[[nodiscard]] std::optional<std::pair<std::vector<std::filesystem::path>, std::vector<std::filesystem::path>>> list( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should return a struct i think. Not obvious which array is which
} | ||
|
||
if (fileList.empty() && directoryList.empty()) { | ||
return std::nullopt; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Null should mean "the path you gave me doesnt exist"
This means "the path you gave me either doesnt exist or exists but is empty"
The empty case should return both vectors left empty
return path == "" || path == "/" || path == "\\"; | ||
} | ||
|
||
std::filesystem::path normalizePath(std::filesystem::path&& path) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this is worth a doc comment explaining why we have to perform this ourselves
im also surprised that there's no std filesystem method which can check if a given path is contained within another (or there is in which case we should be using that)
Changes