Open serge-hulne opened 1 year ago
Win32 isn't explicitly tested but I suppose it should work. Does the folder mentioned in the error message contain any files?
Yes, I used the same set-up as on macOS:
If you want to try it, I put the code on GitHub: https://github.com/serge-hulne/crystal_serve_baked
I think I figured out the main issue why it's failing on Windows.
baked_file_system
uses Dir.glob
to find the files. The documentation for this method specifies that the path seperator must be /
:
NOTE Path separator in patterns needs to be always /. The returned file names use system-specific path separators.
On Windows the path seperator of course ends up being \
Not sure if this is the best way, but I was able to fix this by using to_posix
, something like:
- files = Dir.glob(File.join(root_path, "**", "*"))
+ files = Dir.glob(Path[root_path, "**", "*"].to_posix)
Some of the tests will still fail even with this, mostly due to more path issues, but a couple due to git handily converting files to CRLF :sweat_smile: But nothing big preventing this from working!
When trying the following code on Windows 11 (code which works under macOS)
I got the error message: