schovi / baked_file_system

Virtual File System for Crystal language. Embedding your assets into final binary.
MIT License
177 stars 18 forks source link

Fix "BakedFileSystem empty: no files" error on Windows #48

Closed jansul closed 1 year ago

jansul commented 1 year ago

Not sure if you are taking contributions, but here's my fix for #47 :sweat_smile:

As mentioned in the issue, the main problem is Windows using the "wrong" path separator compared to what is expected by Dir.glob, and within baked_file_system.

To fix this, I just call .to_posix in the two places it's needed. Not sure if this the best way of handling it (possibly baked_file_system should accept both path separators when calling .get etc?) but it seems to work with what I've tested it with.

I've also added a .gitattributes file to ensure Git doesn't change the line endings when checking out the tests, as some of them check for the exact size in bytes of baked files

Lastly, I updated the Github Actions workflow to include both Windows and Mac.