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 c7bcddf765..6a213cdc14 100644 --- a/packages/rsx/src/hot_reload/hot_reloading_file_map.rs +++ b/packages/rsx/src/hot_reload/hot_reloading_file_map.rs @@ -13,7 +13,7 @@ pub use proc_macro2::TokenStream; pub use std::collections::HashMap; pub use std::sync::Mutex; pub use std::time::SystemTime; -use std::{collections::HashSet, ffi::OsStr, fmt::format, marker::PhantomData, path::PathBuf}; +use std::{collections::HashSet, ffi::OsStr, marker::PhantomData, path::PathBuf}; pub use std::{fs, io, path::Path}; pub use std::{fs::File, io::Read}; use syn::spanned::Spanned; @@ -304,17 +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 + + #[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().to_owned()) - .collect::>().join("/") - + ":" - + &line.to_string() - + ":" - + &column.to_string() - // the byte index doesn't matter, but dioxus needs it - + ":0"; - location + .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 {