garcia / simfile

A modern simfile parsing & editing library for Python 3
MIT License
62 stars 7 forks source link

SM/SSC detection by file extension is broken #18

Closed garcia closed 2 years ago

garcia commented 2 years ago

https://github.com/garcia/simfile/blob/272c83734e85b4518fe725ec1c852fbf81635b05/simfile/__init__.py#L38-L41

Neither of these conditions will ever be true. Splitting with .rpartition('.') means the extension won't have the . prefix.

In practice, this rarely causes issues because detection by VERSION tag is reliable enough. But if you use simfile.open to open an empty file with a .ssc extension, it comes back as an SMSimfile. Noticed this while writing unit tests.