Skip to content

Commit

Permalink
refactor: no delete the existing role/session when saving with a new …
Browse files Browse the repository at this point in the history
…name (#863)
  • Loading branch information
sigoden committed Sep 13, 2024
1 parent a9ea86f commit c821652
Showing 1 changed file with 0 additions and 12 deletions.
12 changes: 0 additions & 12 deletions src/config/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -918,13 +918,7 @@ impl Config {
}
let role_path = Self::role_file(&role_name)?;
if let Some(role) = self.role.as_mut() {
let old_name = role.name().to_string();
role.save(&role_name, &role_path, self.working_mode.is_repl())?;
if old_name != role_name {
if let Ok(path) = Self::role_file(&old_name) {
let _ = remove_file(&path);
}
}
}

Ok(())
Expand Down Expand Up @@ -1050,13 +1044,7 @@ impl Config {
};
let session_path = self.session_file(&session_name)?;
if let Some(session) = self.session.as_mut() {
let old_name = session.name().to_string();
session.save(&session_name, &session_path, self.working_mode.is_repl())?;
if old_name != session_name {
if let Ok(path) = self.session_file(&old_name) {
let _ = remove_file(&path);
}
}
}
Ok(())
}
Expand Down

0 comments on commit c821652

Please sign in to comment.