diff --git a/packages/rsx/src/hot_reload/hot_reloading_file_map.rs b/packages/rsx/src/hot_reload/hot_reloading_file_map.rs index df2c1124d3..6a213cdc14 100644 --- a/packages/rsx/src/hot_reload/hot_reloading_file_map.rs +++ b/packages/rsx/src/hot_reload/hot_reloading_file_map.rs @@ -304,14 +304,24 @@ impl FileMap { pub fn template_location(old_start: proc_macro2::LineColumn, file: &Path) -> String { let line = old_start.line; let column = old_start.column + 1; - let location = file.display().to_string() - + ":" - + &line.to_string() - + ":" - + &column.to_string() - // the byte index doesn't matter, but dioxus needs it - + ":0"; - location + + #[cfg(not(target_os = "windows"))] + let path = file.to_string_lossy().to_string(); + + #[cfg(target_os = "windows")] + let path = file + .components() + .map(|c| c.as_os_str().to_string_lossy()) + .collect::>() + .join("/"); + + path + + ":" + + &line.to_string() + + ":" + + &column.to_string() + // the byte index doesn't matter, but dioxus needs it + + ":0" } struct FileMapSearchResult {