Skip to content
Closed
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
10 changes: 5 additions & 5 deletions src/shim_filesystem.rs
Original file line number Diff line number Diff line change
Expand Up @@ -290,17 +290,17 @@ cfg_if! {
pub fn add_in_memory_file(path: &str, content: &str) {
{
let mut files = IN_MEMORY_FILES.write().unwrap();
files.get_or_insert_with(HashMap::new).insert(path.to_string(), content.to_string());
// normalize keys the same way lookups do (on Windows, this converts '/' to '\')
files.get_or_insert_with(HashMap::new).insert(get_in_memory_key(Path::new(path)), content.to_string());
}

let path_obj = Path::new(path);
{
let mut dirs = IN_MEMORY_DIRS.write().unwrap();
let dirs = dirs.get_or_insert_with(HashSet::new);
for parent in path_obj.ancestors().skip(1) {
let parent_str = parent.to_str().unwrap_or_default();
for parent in Path::new(path).ancestors().skip(1) {
let parent_str = get_in_memory_key(parent);
if !parent_str.is_empty() {
dirs.insert(parent_str.to_string());
dirs.insert(parent_str);
}
}
}
Expand Down
Loading