Skip to content

Commit 17a3069

Browse files
committed
compiler: module paths are POSIX on Windows too
The module graph keys modules by POSIX path (modules::join_path), so a Windows entry (D:\a\main.rx) found none of its imports (MO-6). app() and rxc's abs() now hand it D:/a/main.rx, which Windows opens alike. Found by the compiler workflow's Windows test. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_0117BoWMdD4K7882vob4J9vq
1 parent a6af933 commit 17a3069

2 files changed

Lines changed: 4 additions & 1 deletion

File tree

‎compiler/src/app.rs‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,8 @@ pub fn target(name: &str) -> Target {
2525

2626
/// `{entry, css, modules: {path: {code, map}}}`, or `{diagnostics: [...]}` / `{error}`. `entry` is an absolute path.
2727
pub fn app(entry: &str, target: Target, module_name: &str) -> Value {
28+
// module keys are POSIX paths (`modules::join_path`); Windows takes `D:/a/b.rx` as it takes `D:\a\b.rx`
29+
let entry = &entry.replace('\\', "/");
2830
(|| {
2931
if read_disk(entry).is_none() {
3032
return Err(json!({ "error": format!("{entry}: no such file") }));

‎compiler/src/main.rs‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,8 @@ use std::path::Path;
2828

2929

3030
fn abs(f: &str) -> String {
31-
std::path::absolute(f).map(|p| p.to_string_lossy().into_owned()).unwrap_or_else(|_| f.to_string())
31+
// module keys are POSIX paths (`modules::join_path`), on Windows too
32+
std::path::absolute(f).map(|p| p.to_string_lossy().into_owned()).unwrap_or_else(|_| f.to_string()).replace('\\', "/")
3233
}
3334

3435
fn conform_one(entry: &str, files: &HashMap<String, String>) -> Value {

0 commit comments

Comments
 (0)