fix: canonicalize root path for module inference, fix crate-to-module mapping
This commit is contained in:
@@ -20,8 +20,10 @@ impl ModuleName {
|
||||
root: &Path,
|
||||
module_mappings: &HashMap<String, String>,
|
||||
) -> Option<Self> {
|
||||
let canonical_root = root.canonicalize().unwrap_or_else(|_| root.to_path_buf());
|
||||
let root_str = canonical_root.to_str().unwrap_or("");
|
||||
let relative = file_path
|
||||
.strip_prefix(root.to_str().unwrap_or(""))
|
||||
.strip_prefix(root_str)
|
||||
.unwrap_or(file_path)
|
||||
.trim_start_matches('/');
|
||||
|
||||
|
||||
Reference in New Issue
Block a user