Skip to content

Commit 3e2e123

Browse files
committed
improved export paths in old version discovery
1 parent c147243 commit 3e2e123

File tree

1 file changed

+29
-1
lines changed

1 file changed

+29
-1
lines changed

src-tauri/src/lib/utils.rs

Lines changed: 29 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -448,7 +448,35 @@ pub fn parse_esp_idf_json(idf_json_path: &str) -> Result<()> {
448448
println!("IDF version: {}", idf_version);
449449
println!("activation script path: {}", path_for_activation_script);
450450
println!("Python path: {}", python);
451-
let export_paths = vec![config.git_path.clone()];
451+
// export paths
452+
let tools_json_file = find_by_name_and_extension(Path::new(&idf_path), "tools", "json");
453+
if tools_json_file.is_empty() {
454+
return Err(anyhow!("tools.json file not found"));
455+
}
456+
457+
debug!("Tools json file: {:?}", tools_json_file);
458+
459+
let tools = match crate::idf_tools::read_and_parse_tools_file(&tools_json_file.first().unwrap()){
460+
Ok(tools) => tools,
461+
Err(e) => {
462+
return Err(anyhow!("Failed to read tools.json file: {}", e));
463+
}
464+
};
465+
let mut export_paths:Vec<String> = crate::idf_tools::get_tools_export_paths(
466+
tools,
467+
vec!["all".to_string()],
468+
&tools_path,
469+
)
470+
.into_iter()
471+
.map(|p| {
472+
if std::env::consts::OS == "windows" {
473+
crate::replace_unescaped_spaces_win(&p)
474+
} else {
475+
p
476+
}
477+
})
478+
.collect();
479+
export_paths.push(config.git_path.clone());
452480
match import_single_version(
453481
path_for_activation_script,
454482
&idf_path,

0 commit comments

Comments
 (0)