Skip to content

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

Draft
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

yogwoggf
Copy link
Contributor

Changes

  • Exposes the same interface from TASBox inside of the Vpk class to list directories

@yogwoggf yogwoggf requested a review from Derpius May 20, 2025 01:52
@yogwoggf yogwoggf self-assigned this May 20, 2025
@yogwoggf
Copy link
Contributor Author

Don't merge yet (label isnt on this repo)

@yogwoggf yogwoggf marked this pull request as draft May 20, 2025 06:31
@@ -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(
Copy link
Member

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;
Copy link
Member

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) {
Copy link
Member

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)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants