module

Hwaro::WindowsPaths

hwaro turns file paths into URLs, output paths and cache keys as /-separated strings ("/" + Path[f].relative_to("content").to_s, File.join(output_dir, url), …). On Windows the stdlib builds those paths with \, which leaked into generated links and broke every comparison against a / path.

Rather than route ~400 call sites through a helper, the path-producing stdlib methods return / on Windows: Path#to_s (which File.join and File.expand_path go through) and Dir.current. Every Windows file API accepts /, and \ can't appear in a Windows file name, so the swap is lossless. Compiled out everywhere else.

Class methods

to_slash(path : String) : String

\ to /, except for an extended-length path (\\?\C:\...): Windows passes those to the filesystem verbatim, so / there is not a separator.

Source