mcbeet / beet

The Minecraft pack development kit.
https://mcbeet.dev
MIT License
141 stars 15 forks source link

feat: support for empty file names #436

Open edayot opened 7 months ago

edayot commented 7 months ago

The function with an empty name .mcfunction is currently not supported by beet atm.

This PR fixes this issue by modifying the code where the extensions of a file are calculated (in beet/library/utils.py).

Q/A

vberlier commented 7 months ago

Arf, I apologize for leaving your issue unanswered for so long! I remember that back when I first saw the issue, I thought that allowing empty names could cause problems in other places because beet plugins often just assume that the name can't be empty. I wanted to look into it more in depth but eventually I just forgot and never got back to you.

I still don't have a clear answer though. I've always felt like Mojang doesn't even know that empty names are allowed. If it was never intended, they could very well make it an error the moment they realize and a bunch of packs would break. It just seems like a bug that's bound to be fixed sooner or later so I generally avoid relying on it.

But it's true that as a build tool, beet should strictly conform to the game's behavior. I'll have to look through a couple plugins to see if additional changes are required to take into account empty names.

edayot commented 7 months ago

Yeah it always seemed very hacky to me to use empty filenames, just writing function namespace: feels weird, but people are using it. Do i have to push the files in test/snapshots/** to make the test pass ?

vberlier commented 7 months ago

Yeah you have to commit the snapshots