Skip to content

Commit ad46e5a

Browse files
authored
Fix getting from root directory from the addon zip (#3)
1 parent 698243f commit ad46e5a

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

src/addons.rs

+11-1
Original file line numberDiff line numberDiff line change
@@ -176,7 +176,7 @@ impl Manager {
176176

177177
let mut addon_path = self.addon_dir.to_owned();
178178
let addon_name = archive.by_index(0)?;
179-
let addon_name = addon_name.name();
179+
let addon_name = get_root_dir(&addon_name.mangled_name());
180180
addon_path.push(addon_name);
181181

182182
let addon = self
@@ -230,3 +230,13 @@ fn find_first_in_node<T>(node: &Rc<Node>, f: &dyn Fn(&Rc<Node>) -> Option<T>) ->
230230
}
231231
}
232232
}
233+
234+
fn get_root_dir(path: &Path) -> PathBuf {
235+
match path.parent() {
236+
None => path.to_owned(),
237+
Some(parent) => match parent.to_str().unwrap() {
238+
"" => path.to_owned(),
239+
&_ => get_root_dir(parent)
240+
}
241+
}
242+
}

0 commit comments

Comments
 (0)