Skip to content
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

Fix loading of resources using incorrect offset #128

Merged
merged 1 commit into from
Oct 24, 2019

Conversation

andreparames
Copy link

Hi! Thanks for this awesome project.

When using __loader__.get_resource_loader(package).open_resource(filename), we were getting a strange result: the contents of the file came out together with the content of other embedded files.

Turns out it was always reading from the start of the first file, since the data offset wasn't getting updated as it moved along the files.

This is my first contribution to a Rust project, so feel free to tell me if I made some mistake, though the change is simple enough that I hope I haven't 😄

When the HashMap of resources is being initialized, the start
location of every file was being set as the start location of the
first file, since the offset wasn't being updated after adding each
file.
Copy link
Owner

@indygreg indygreg left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good!

@indygreg indygreg merged commit 9532817 into indygreg:main Oct 24, 2019
@andreparames andreparames deleted the fix-data-resource-offset branch November 4, 2019 09:54
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