summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorsigoden <sigoden@gmail.com>2024-09-13 09:20:43 +0800
committerGitHub <noreply@github.com>2024-09-13 09:20:43 +0800
commitc821652ed98819f09e0ae29269fd5410e256813e (patch)
treeb4763ee79d745dfe62f222b6e4e30d98d1d02511 /src
parenta9ea86f3f8c9cba5e453b7a50894da682e022ba8 (diff)
downloadaichat-c821652ed98819f09e0ae29269fd5410e256813e.tar.gz
refactor: no delete the existing role/session when saving with a new name (#863)
Diffstat (limited to 'src')
-rw-r--r--src/config/mod.rs12
1 files changed, 0 insertions, 12 deletions
diff --git a/src/config/mod.rs b/src/config/mod.rs
index a92c65f..d58f4f1 100644
--- a/src/config/mod.rs
+++ b/src/config/mod.rs
@@ -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(())
@@ -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(())
}