mirror of
https://github.com/clash-verge-rev/clash-verge-rev.git
synced 2026-12-01 10:40:14 +08:00
refactor(profile): extract profile models and index rules
Move profile models and index rules into the crate, preserving serialization and returning a typed missing-profile error.
This commit is contained in:
@@ -2,7 +2,7 @@ use super::CmdResult;
|
||||
use crate::{
|
||||
cmd::StringifyErr as _,
|
||||
cmd::validate::{ValidationNoticeTarget, handle_validation_notice},
|
||||
config::{Config, IProfiles, PrfItem},
|
||||
config::{Config, IProfiles, read_profile_item_file},
|
||||
core::auto_backup::{self, AutoBackupTrigger},
|
||||
core::{
|
||||
CoreManager, handle,
|
||||
@@ -58,13 +58,7 @@ pub async fn save_profile_file(
|
||||
))
|
||||
})?;
|
||||
let original_content = if original_existed {
|
||||
PrfItem {
|
||||
file: Some(rel_path.clone()),
|
||||
..Default::default()
|
||||
}
|
||||
.read_file()
|
||||
.await
|
||||
.stringify_err()?
|
||||
read_profile_item_file(Some(rel_path.as_str())).await.stringify_err()?
|
||||
} else {
|
||||
String::new()
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user