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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix missing map files preventing map saves #21345

Merged
merged 1 commit into from Apr 11, 2024
Merged

Conversation

PunkPun
Copy link
Member

@PunkPun PunkPun commented Feb 17, 2024

Regression from #20630. Currently you are forced to have to have a preview for a map in order to generate a new preview
Reported by Therapist on discord


The git diff looks atrocious for what is a very simple change 馃槢

@PunkPun PunkPun added this to the Next Release milestone Feb 17, 2024
Copy link
Contributor

@anvilvapre anvilvapre left a comment

Choose a reason for hiding this comment

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

untested.

{
var stream = Package.GetStream(filename);
if (stream == null || !Enumerable.SequenceEqual(data, stream.ReadAllBytes()))
toPackage.Update(filename, data);
Copy link
Contributor

Choose a reason for hiding this comment

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

Might as well compare two Spans? (Or even just always update?)

https://stackoverflow.com/questions/43289/comparing-two-byte-arrays-in-net

Copy link
Member Author

Choose a reason for hiding this comment

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

We don't want to always update as to avoid changing the file edit date, see #20630. When it comes to spans wouldn't this be too much data?

Copy link
Member

Choose a reason for hiding this comment

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

Enumerable.SequenceEqual will drop to comparing spans internally if it is possible. So I'd keep this as-is for readability.

@abcdefg30 abcdefg30 merged commit 150e28a into OpenRA:bleed Apr 11, 2024
3 checks passed
@abcdefg30
Copy link
Member

Changelog

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

Successfully merging this pull request may close these issues.

None yet

4 participants