Skip to content

Commit 23bf5f7

Browse files
committed
updated according to changes in the scripts location
1 parent cfe0626 commit 23bf5f7

File tree

3 files changed

+22
-53
lines changed

3 files changed

+22
-53
lines changed

src-tauri/src/cli/mod.rs

Lines changed: 8 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -322,7 +322,6 @@ pub async fn run_cli(cli: Cli) -> anyhow::Result<()> {
322322
}
323323
Commands::Discover {path } => {
324324
info!("Discovering available versions... (This can take couple of minutes)");
325-
// TODO: add warning and confirmation
326325
let path = path.unwrap_or_else(|| {
327326
let default_path = match std::env::consts::OS {
328327
"windows" => {
@@ -401,7 +400,7 @@ pub async fn run_cli(cli: Cli) -> anyhow::Result<()> {
401400
}
402401
config
403402
}
404-
Err(err) => {
403+
Err(_err) => {
405404
debug!("No ide config found. New will be created.");
406405
IdfConfig::default()
407406
}
@@ -412,21 +411,16 @@ pub async fn run_cli(cli: Cli) -> anyhow::Result<()> {
412411
if config.clone().is_path_in_config(dir.clone()) {
413412
info!("Already present!");
414413
} else {
415-
info!("Will be added...");
414+
info!("Can be added...");
416415
paths_to_add.push(dir);
417416
}
418-
419417
}
420-
// TODO: ask the user to select which IDFs to add
421-
for p in paths_to_add {
422-
match try_import_existing_idf(&p) {
423-
Ok(_) => {
424-
info!("Added to config: {}", p);
425-
}
426-
Err(err) => {
427-
error!("Failed to add: {} - reason :{}",p, err);
428-
}
429-
}
418+
if paths_to_add.is_empty() {
419+
info!("No new IDF directories found to add.");
420+
return Ok(());
421+
} else {
422+
info!("Found {} new IDF directories available to add:", paths_to_add.len());
423+
info!("You can add them using `eim install` command with the `--path` option.");
430424
}
431425
Ok(())
432426
}

src-tauri/src/gui/mod.rs

Lines changed: 0 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -170,37 +170,6 @@ impl ToolSetup {
170170
}
171171
}
172172

173-
// async fn install_single_version(
174-
// app_handle: AppHandle,
175-
// settings: &Settings,
176-
// version: String,
177-
// ) -> Result<(), Box<dyn std::error::Error>> {
178-
// info!("Installing IDF version: {}", version);
179-
180-
// let version_path = prepare_installation_directories(app_handle.clone(), settings, &version)?;
181-
// let idf_path = version_path.clone().join("esp-idf");
182-
// download_idf(&app_handle, settings, &version, &idf_path).await?;
183-
// let export_vars = setup_tools(&app_handle, settings, &idf_path, &version).await?;
184-
// let tools_install_path = version_path.clone().join(
185-
// settings
186-
// .tool_install_folder_name
187-
// .clone()
188-
// .unwrap_or_default(),
189-
// );
190-
// let idf_python_env_path = tools_install_path.clone().join("python").join(&version).join("venv");
191-
// let activation_script_path = settings.esp_idf_json_path.clone().unwrap_or_default();
192-
// idf_im_lib::single_version_post_install(
193-
// &activation_script_path,
194-
// idf_path.to_str().unwrap(),
195-
// &version,
196-
// tools_install_path.to_str().unwrap(),
197-
// export_vars,
198-
// Some(idf_python_env_path.to_str().unwrap()),
199-
// );
200-
201-
// Ok(())
202-
// }
203-
204173
// Helper function to check if a process is running on Windows
205174
#[cfg(target_os = "windows")]
206175
fn is_process_running(pid: u32) -> bool {

src-tauri/src/lib/utils.rs

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
use crate::{
2-
command_executor::execute_command, idf_config::{IdfConfig, IdfInstallation}, idf_tools::{self, read_and_parse_tools_file}, replace_unescaped_spaces_win, settings::Settings, single_version_post_install, version_manager::get_default_config_path
2+
command_executor::execute_command, idf_config::{IdfConfig, IdfInstallation}, idf_tools::{self, read_and_parse_tools_file}, replace_unescaped_spaces_win, settings::{self, Settings}, single_version_post_install, version_manager::get_default_config_path
33
};
44
use anyhow::{anyhow, Result, Error};
55
use git2::Repository;
@@ -407,9 +407,14 @@ pub fn parse_tool_set_config(config_path: &str) -> Result<()> {
407407

408408
let new_activation_script = match std::env::consts::OS {
409409
"windows" => format!(
410+
<<<<<<< HEAD
410411
"{}\\Microsoft.{}.PowerShell_profile.ps1",
411412
activation_script_path,
412413
&tool_set.idf_version
414+
=======
415+
"{}\\Microsoft.PowerShell_profile.ps1",
416+
activation_script_path
417+
>>>>>>> b06d894 (updated according to changes in the scripts location)
413418
),
414419
_ => format!(
415420
"{}/activate_idf_{}.sh",
@@ -498,12 +503,13 @@ pub fn parse_esp_idf_json(idf_json_path: &str) -> Result<()> {
498503
let idf_path = value.path;
499504
let python = value.python;
500505
let tools_path = config.idf_tools_path.clone();
501-
let path_for_activation_script = idf_json_path.parent().unwrap().to_str().unwrap();
506+
let settings = crate::settings::Settings::default();
507+
let path_for_activation_script = settings.esp_idf_json_path.clone().unwrap_or_default();
502508

503-
println!("IDF tools path: {}", tools_path);
504-
println!("IDF version: {}", idf_version);
505-
println!("activation script path: {}", path_for_activation_script);
506-
println!("Python path: {}", python);
509+
debug!("IDF tools path: {}", tools_path);
510+
debug!("IDF version: {}", idf_version);
511+
debug!("activation script path: {}", &path_for_activation_script);
512+
debug!("Python path: {}", python);
507513
// export paths
508514
let tools_json_file = find_by_name_and_extension(Path::new(&idf_path), "tools", "json");
509515
if tools_json_file.is_empty() {
@@ -534,7 +540,7 @@ pub fn parse_esp_idf_json(idf_json_path: &str) -> Result<()> {
534540
.collect();
535541
export_paths.push(config.git_path.clone());
536542
match import_single_version(
537-
path_for_activation_script,
543+
&path_for_activation_script,
538544
&idf_path,
539545
&idf_version,
540546
&tools_path,
@@ -680,7 +686,7 @@ pub fn import_single_version(path_to_create_activation_script: &str,idf_location
680686
),
681687
_ => format!(
682688
"{}/activate_idf_{}.sh",
683-
PathBuf::from(path_to_create_activation_script).parent().unwrap().to_str().unwrap(),
689+
path_to_create_activation_script,
684690
idf_version
685691
),
686692
};

0 commit comments

Comments
 (0)