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

Sort lines in assets.txt #205

Merged
merged 1 commit into from
Oct 9, 2024
Merged

Conversation

henu
Copy link
Contributor

@henu henu commented Oct 8, 2024

First of all, sorry if this PR is crappy, I just made it very quickly while being tired in hopes it will help the LibGDX project.

I noticed adding .sort() fixed a really annoying problem of assets/assets.txt constantly changing order of lines if the project was developed on different machines.

Copy link

@SonicGDX SonicGDX left a comment

Choose a reason for hiding this comment

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

Might be worth updating the comment too to mention the sort, but depends if @tommyettinger thinks that is necessary

@tommyettinger
Copy link
Member

I think I'll merge this regardless, but do you think users would prefer a case-insensitive sort (as provided in Java by String.CASE_INSENSITIVE_ORDER)? I found it a bit more readable to have:

.gitkeep
A-Starry-License.txt
A-Starry.ttf
AStarry-standard.fnt
AStarry-standard.png
Bitter-License.txt
Bitter-standard.fnt
Bitter-standard.png
font_main.ttf
Gentium-License.txt
Gentium-Un-Italic-standard.dat
Gentium-Un-Italic-standard.png
Gentium-Un-Italic.ttf
GentiumUnItalic-standard.fnt
GentiumUnItalic-standard.png
Inconsolata-LGC-License.txt
Inconsolata-LGC.ttf
Open-Sans-License.txt
uiskin.png
uiskin2.atlas
uiskin2.json

Instead of what I had with just sort(),

.gitkeep
A-Starry-License.txt
A-Starry.ttf
AStarry-standard.fnt
AStarry-standard.png
Bitter-License.txt
Bitter-standard.fnt
Bitter-standard.png
Gentium-License.txt
Gentium-Un-Italic-standard.dat
Gentium-Un-Italic-standard.png
Gentium-Un-Italic.ttf
GentiumUnItalic-standard.fnt
GentiumUnItalic-standard.png
Inconsolata-LGC-License.txt
Inconsolata-LGC.ttf
Open-Sans-License.txt
font_main.ttf
uiskin.png
uiskin2.atlas
uiskin2.json

The only change I made was from sort() to sort(true, String.CASE_INSENSITIVE_ORDER) . Jumping from Open-Sans to font_main surprised me a bit, so I feel like the case-insensitive sort might help. It's a quick thing I can add on top of this PR, though, so I'll merge now and maybe add the case-insensitive comparator later.

@tommyettinger tommyettinger merged commit cb81c09 into libgdx:master Oct 9, 2024
2 checks passed
@tommyettinger
Copy link
Member

Oh, the case-insensitive sort might mess with ordering if any file prefixes are exactly the same in name other than case. But, that game might not even work at all if building on Windows, due to the case-insensitive file system... I think I'll leave it as-is for now.

@henu henu deleted the sort_assets_txt branch October 10, 2024 19:41
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.

3 participants