Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 8 additions & 4 deletions crates/mako/src/module.rs
Original file line number Diff line number Diff line change
Expand Up @@ -282,7 +282,9 @@ impl PartialOrd for ModuleId {
impl ModuleId {
// we use absolute path as module id now
pub fn new(id: String) -> Self {
Self { id }
Self {
id: win_path(id.as_str()),

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ensure that the win_path function correctly handles all edge cases for path normalization, especially for paths that may contain special characters or invalid sequences.

}
}

pub fn generate(&self, context: &Arc<Context>) -> String {
Expand All @@ -304,20 +306,22 @@ impl ModuleId {

impl From<String> for ModuleId {
fn from(id: String) -> Self {
Self { id }
Self {
id: win_path(id.as_str()),
}
}
}

impl From<&str> for ModuleId {
fn from(id: &str) -> Self {
Self { id: id.to_string() }
Self { id: win_path(id) }
}
}

impl From<PathBuf> for ModuleId {
fn from(path: PathBuf) -> Self {
Self {
id: path.to_string_lossy().to_string(),
id: win_path(path.to_string_lossy().to_string().as_str()),
}
}
}
Expand Down
Loading