Skip to content

Commit 4701e72

Browse files
committed
fix compilation of files starting with lowercase letter
1 parent f6b9282 commit 4701e72

File tree

1 file changed

+12
-11
lines changed

1 file changed

+12
-11
lines changed

rewatch/src/build/compile.rs

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -578,7 +578,7 @@ fn compile_file(
578578
ast_path.to_string_lossy()
579579
)),
580580
}?;
581-
let module_name = helpers::file_path_to_module_name(implementation_file_path, &package.namespace);
581+
let basename = helpers::file_path_to_compiler_asset_basename(implementation_file_path, &package.namespace);
582582
let has_interface = module.get_interface().is_some();
583583
let is_type_dev = module.is_type_dev;
584584
let to_mjs_args = compiler_args(
@@ -631,40 +631,41 @@ fn compile_file(
631631
// because editor tooling doesn't support namespace entries yet
632632
// we just remove the @ for now. This makes sure the editor support
633633
// doesn't break
634-
.join(format!("{module_name}.cmi")),
635-
ocaml_build_path_abs.join(format!("{module_name}.cmi")),
634+
.join(format!("{basename}.cmi")),
635+
ocaml_build_path_abs.join(format!("{basename}.cmi")),
636636
);
637637
let _ = std::fs::copy(
638638
package
639639
.get_build_path()
640640
.join(dir)
641-
.join(format!("{module_name}.cmj")),
642-
ocaml_build_path_abs.join(format!("{module_name}.cmj")),
641+
.join(format!("{basename}.cmj")),
642+
ocaml_build_path_abs.join(format!("{basename}.cmj")),
643643
);
644+
println!("[rewatch] Copying file {basename} to ocaml build path");
644645
let _ = std::fs::copy(
645646
package
646647
.get_build_path()
647648
.join(dir)
648649
// because editor tooling doesn't support namespace entries yet
649650
// we just remove the @ for now. This makes sure the editor support
650651
// doesn't break
651-
.join(format!("{module_name}.cmt")),
652-
ocaml_build_path_abs.join(format!("{module_name}.cmt")),
652+
.join(format!("{basename}.cmt")),
653+
ocaml_build_path_abs.join(format!("{basename}.cmt")),
653654
);
654655
} else {
655656
let _ = std::fs::copy(
656657
package
657658
.get_build_path()
658659
.join(dir)
659-
.join(format!("{module_name}.cmti")),
660-
ocaml_build_path_abs.join(format!("{module_name}.cmti")),
660+
.join(format!("{basename}.cmti")),
661+
ocaml_build_path_abs.join(format!("{basename}.cmti")),
661662
);
662663
let _ = std::fs::copy(
663664
package
664665
.get_build_path()
665666
.join(dir)
666-
.join(format!("{module_name}.cmi")),
667-
ocaml_build_path_abs.join(format!("{module_name}.cmi")),
667+
.join(format!("{basename}.cmi")),
668+
ocaml_build_path_abs.join(format!("{basename}.cmi")),
668669
);
669670
}
670671

0 commit comments

Comments
 (0)