Skip to content

Commit c147243

Browse files
committed
updated activation script creation
1 parent 500c2e1 commit c147243

File tree

2 files changed

+15
-5
lines changed

2 files changed

+15
-5
lines changed

src-tauri/src/lib/mod.rs

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1495,7 +1495,7 @@ pub fn single_version_post_install(
14951495
_ => {
14961496
let install_folder = PathBuf::from(version_instalation_path);
14971497
let install_path = install_folder.parent().unwrap().to_str().unwrap();
1498-
let _ = create_activation_shell_script(
1498+
match create_activation_shell_script(
14991499
// todo: handle error
15001500
install_path,
15011501
idf_path,
@@ -1504,7 +1504,13 @@ pub fn single_version_post_install(
15041504
idf_version,
15051505
export_paths,
15061506
env_vars,
1507-
);
1507+
) {
1508+
Ok(_) => info!("Activation shell script created successfully at {:?}", install_path),
1509+
Err(err) => error!(
1510+
"Failed to create activation shell script: {:?}",
1511+
err.to_string()
1512+
),
1513+
}
15081514
// copy openocd rules (it's noop on macOs)
15091515
match copy_openocd_rules(tool_install_directory) {
15101516
Ok(_) => info!("OpenOCD rules copied successfully"),

src-tauri/src/lib/utils.rs

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -442,11 +442,15 @@ pub fn parse_esp_idf_json(idf_json_path: &str) -> Result<()> {
442442
let idf_path = value.path;
443443
let python = value.python;
444444
let tools_path = config.idf_tools_path.clone();
445+
let path_for_activation_script = idf_json_path.parent().unwrap().to_str().unwrap();
446+
445447
println!("IDF tools path: {}", tools_path);
446448
println!("IDF version: {}", idf_version);
449+
println!("activation script path: {}", path_for_activation_script);
450+
println!("Python path: {}", python);
447451
let export_paths = vec![config.git_path.clone()];
448452
match import_single_version(
449-
idf_json_path.parent().unwrap().to_str().unwrap(),
453+
path_for_activation_script,
450454
&idf_path,
451455
&idf_version,
452456
&tools_path,
@@ -575,7 +579,7 @@ pub fn import_single_version(path_to_create_activation_script: &str,idf_location
575579
return Ok(());
576580
};
577581
let python_env = python.clone().and_then(|s| {
578-
s.find("python_env").map(|index| s[..=index+9].to_string())
582+
s.find("bin").map(|index| s[..=index-1].to_string())
579583
});
580584
single_version_post_install(
581585
path_to_create_activation_script,
@@ -592,7 +596,7 @@ pub fn import_single_version(path_to_create_activation_script: &str,idf_location
592596
),
593597
_ => format!(
594598
"{}/activate_idf_{}.sh",
595-
path_to_create_activation_script,
599+
PathBuf::from(path_to_create_activation_script).parent().unwrap().to_str().unwrap(),
596600
idf_version
597601
),
598602
};

0 commit comments

Comments
 (0)