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 & add tests for template object loading #227

Merged
merged 4 commits into from
Jun 20, 2022

Conversation

aleokdev
Copy link
Contributor

Fixes the underlying issue behind #224, and adds a few tests with a map provided by @Aposhian (Thank you!). It also makes DefaultResourceCache's members public for easy access from tests and whatnot.

aleokdev and others added 3 commits June 12, 2022 18:17
Co-authored-by: Adam Aposhian <aposhian.dev@gmail.com>
Copy link
Member

@bjorn bjorn left a comment

Choose a reason for hiding this comment

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

What caused the actual inconsistency in the base path?

src/objects.rs Outdated Show resolved Hide resolved
src/objects.rs Outdated Show resolved Hide resolved
@aleokdev
Copy link
Contributor Author

aleokdev commented Jun 13, 2022

What caused the actual inconsistency in the base path?

It was being provided both file and directory paths while the code inside assumed it was a directory path only. By making the name clearer I think we'll avoid other issues like this one.

@bjorn
Copy link
Member

bjorn commented Jun 14, 2022

It was being provided both file and directory paths while the code inside assumed it was a directory path only.

Yes, but in my quick review I didn't notice the location where we were passing a file instead of a directory path. I'd personally prefer a patch that just fixes that location.

@@ -102,7 +102,7 @@ impl LayerData {
attrs,
Some(tilesets),
for_tileset,
map_path,
map_path.parent().ok_or(crate::Error::PathIsNotFile)?,
Copy link
Member

Choose a reason for hiding this comment

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

Could we pass in the parent directory to LayerData::new in the first place? Or does the map_path parameter to ImageLayerData::new and GroupLayerData::new need to be the actual map path?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

We could change that, but I was trying to change as few lines as possible since you asked to patch just the bug.

Copy link
Member

Choose a reason for hiding this comment

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

Yeah, that's appreciated! It just highlighted that the inconsistency goes further than this one line. But, we can merge this fix and make it consistent in a follow-up change.

For following this up, I think we should always pass just the directory.

@aleokdev aleokdev merged commit 7622d64 into mapeditor:next Jun 20, 2022
@aleokdev aleokdev deleted the template-fix branch June 20, 2022 08:28
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