Right now, it's effectively only possible to use backslashes (C:\path\to\spec.ksy) to specify the full path to a .ksy file on Windows, which is quite restrictive - basically all programs on Windows accept paths with forward slashes, so you get used to being able to use them.
I also don't think that the Windows users who tried to use forward slash .ksy paths and got the following cryptic error because of it:
C:/temp/kaitai_struct/visualizer/lib/kaitai/struct/visualizer/ksy_compiler.rb:84:in `block (2 levels) in compile_formats':
undefined method `[]' for nil:NilClass (NoMethodError)
...had any clue what's going on and that it's caused by the use of forward slashes - this just typically doesn't occur to you when you can use forward slashes pretty much everywhere. So they would probably conclude that ksv and ksdump can't be used on Windows and maybe resort to installing it in WSL.
This bug is caused by the fact that the compiler's --ksc-json-output uses backslash paths as JSON keys on Windows, so when KSV tries to use the forward slash path (directly from the CLI argument provided by the user) as the key on this line:
Right now, it's effectively only possible to use backslashes (
C:\path\to\spec.ksy
) to specify the full path to a .ksy file on Windows, which is quite restrictive - basically all programs on Windows accept paths with forward slashes, so you get used to being able to use them.I also don't think that the Windows users who tried to use forward slash .ksy paths and got the following cryptic error because of it:
...had any clue what's going on and that it's caused by the use of forward slashes - this just typically doesn't occur to you when you can use forward slashes pretty much everywhere. So they would probably conclude that
ksv
andksdump
can't be used on Windows and maybe resort to installing it in WSL.This bug is caused by the fact that the compiler's
--ksc-json-output
uses backslash paths as JSON keys on Windows, so when KSV tries to use the forward slash path (directly from the CLI argument provided by the user) as the key on this line:https://github.com/kaitai-io/kaitai_struct_visualizer/blob/77252f581e366cedcba00834b990a124363e6551/lib/kaitai/struct/visualizer/ksy_compiler.rb#L83
..., it can't find anything and crashes.
The solution is to convert the path to use backslashes and also try using it as the key (in case the direct use doesn't find anything).