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 errors with map resources being not found in 2.6. #10504

Merged
merged 5 commits into from May 25, 2022

Conversation

asvitkine
Copy link
Contributor

Change Summary & Additional Notes

Fix errors with map resources being not found in 2.6.

This was caused by some maps having duplicate files (e.g. a polygon.txt file in baseTiles folder). Before this change, it's undefined which of these files will be found first and all other files will be expected to be alongside it.

With this change, the search returns files in a deterministic order, sorted by path length. So files closer to the root will be first in the list. This makes the behavior deterministic across platforms and the map to use the file closest to the map root.

Tested:
Loading WW2 Oil and Snow on Windows, both starting the game and viewing the images in the game notes. Without this change, that map exhibited #10417.

Release Note

This was caused by some maps having duplicate files (e.g. a polygon.txt file in baseTiles folder). Before this change, it's undefined which of these files will be found first and all other files will be expected to be alongside it.

With this change, the search returns files in a deterministic order, sorted by path length. So files closer to the root will be first in the list. This makes the behavior deterministic across platforms and the map to use the file closest to the map root.
@codecov
Copy link

codecov bot commented May 25, 2022

Codecov Report

Merging #10504 (49fbc3a) into master (0333b85) will increase coverage by 0.00%.
The diff coverage is 80.00%.

@@            Coverage Diff            @@
##             master   #10504   +/-   ##
=========================================
  Coverage     27.86%   27.87%           
- Complexity     7972     7973    +1     
=========================================
  Files          1202     1202           
  Lines         77911    77912    +1     
  Branches      10610    10610           
=========================================
+ Hits          21713    21715    +2     
+ Misses        54212    54209    -3     
- Partials       1986     1988    +2     
Impacted Files Coverage Δ
...framework/map/file/system/loader/InstalledMap.java 16.32% <0.00%> (ø)
...iplea/map/description/file/MapDescriptionYaml.java 63.88% <100.00%> (ø)
...map/description/file/MapDescriptionYamlReader.java 92.30% <100.00%> (ø)
...extras/src/main/java/org/triplea/io/FileUtils.java 40.32% <100.00%> (+6.17%) ⬆️
...rc/main/java/games/strategy/net/nio/NioReader.java 82.50% <0.00%> (-3.75%) ⬇️
.../main/java/games/strategy/net/ClientMessenger.java 62.50% <0.00%> (-2.09%) ⬇️
...ea/http/client/web/socket/WebSocketConnection.java 64.94% <0.00%> (-1.04%) ⬇️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 0333b85...49fbc3a. Read the comment docs.

@asvitkine asvitkine merged commit 485cc17 into triplea-game:master May 25, 2022
@asvitkine asvitkine deleted the fix_resource_search branch July 16, 2023 14: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.

None yet

1 participant