Skip to content

Commit

Permalink
modified the ide json file so its m0ore easy to parse (#42)
Browse files Browse the repository at this point in the history
Co-authored-by: Petr Gadorek <[email protected]>
  • Loading branch information
Hahihula and Petr Gadorek authored Nov 6, 2024
1 parent e937a72 commit 6af0650
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions src/settings.rs
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ impl Settings {
///
/// This function returns a `Result` which is `Ok(())` on success or an error message as a `String` on failure.
pub fn save_esp_ide_json(&self, file_path: &str) -> Result<(), String> {
let mut idf_installed = json!({});
let mut idf_installed = json!([]);
if let Some(versions) = &self.idf_versions {
for version in versions {
let id = format!("esp-idf-{}", Uuid::new_v4().to_string().replace("-", "")); //todo: use hash of path or something stable
Expand Down Expand Up @@ -148,13 +148,18 @@ impl Settings {
.join(format!("activate_idf_{}.sh", version)),
};

idf_installed[&id] = json!({
let idf_installed_entry = json!({
"id": id,
"name": version,
"path": idf_path,
"python": python_path,
"idfToolsPath": tools_path,
"activationScript": activation_script,
});
idf_installed
.as_array_mut()
.unwrap()
.push(idf_installed_entry);
}
}

Expand Down

0 comments on commit 6af0650

Please sign in to comment.