Always use forward slash on import paths#346
Conversation
| }; | ||
|
|
||
| let path = if cfg!(target_os = "windows") { | ||
| str_path.replace('\\', "/") |
There was a problem hiding this comment.
I dont think this is sufficient, since paths can contain \.
We might need to iterate over the path components, not sure though.
There was a problem hiding this comment.
I dont think this is sufficient, since paths can contain \.
Wdym? Is a component allowed to contain \? This replaces every \ for /
There was a problem hiding this comment.
It seems \ is allowed in Unix file/directory names, but this shouldn't be a problem, as the replace only happens if the user's OS is Windows, where \ is not allowed in file/directory names.
I also suspect TS itself would not be very fond of a file containaing \ in its name.
It could even be a reasonable idea to throw a compile time error if #[ts(export_to)] or TS_RS_EXPORT_DIR contain backslashes as that would probably produce unintended behavior and destroy portability, by having a path that can't exist on Windows. Of course, doing so would be another of those "technically a breaking breaking change, but probably won't affect anyone" versions
There was a problem hiding this comment.
I think you're right, sorry about that!
I thought I remembered some weird rules for paths on windows, but i was mistaken.
NyxCode
left a comment
There was a problem hiding this comment.
thanks man! especially happy about the windows CI!
Goal
This PR changes import paths such that they will always use forward slash
/as the path separator, even on Windows. It also adds a windows test run to the CICloses #345
Changes
If
target_os = "windows", replace\with/Checklist