summaryrefslogtreecommitdiff
path: root/legacy_data/src/data/local/modified_status.rs
diff options
context:
space:
mode:
author魏曹先生 <1992414357@qq.com>2026-02-05 22:35:05 +0800
committer魏曹先生 <1992414357@qq.com>2026-02-05 22:35:05 +0800
commit27f6414ad1ff451feb0044af62f37dc2a6255ffa (patch)
treecb5693bc014cc8579dcf02a730fd4d2a5dfcf1a5 /legacy_data/src/data/local/modified_status.rs
parentade2fcb9302a4ab759795820dbde3b2b269490ee (diff)
Remove examples and legacy code, update .gitignore
- Delete examples directory and its example action system - Rename actions/ to legacy_actions/ and data/ to legacy_data/ - Update Cargo.toml license file reference - Move setup scripts to scripts/dev/ directory - Add todo.txt patterns to .gitignore
Diffstat (limited to 'legacy_data/src/data/local/modified_status.rs')
-rw-r--r--legacy_data/src/data/local/modified_status.rs30
1 files changed, 30 insertions, 0 deletions
diff --git a/legacy_data/src/data/local/modified_status.rs b/legacy_data/src/data/local/modified_status.rs
new file mode 100644
index 0000000..e0e6dd5
--- /dev/null
+++ b/legacy_data/src/data/local/modified_status.rs
@@ -0,0 +1,30 @@
+use crate::{constants::CLIENT_FILE_VAULT_MODIFIED, env::current_local_path};
+
+pub async fn check_vault_modified() -> bool {
+ let Some(current_dir) = current_local_path() else {
+ return false;
+ };
+
+ let record_file = current_dir.join(CLIENT_FILE_VAULT_MODIFIED);
+ if !record_file.exists() {
+ return false;
+ }
+
+ let Ok(contents) = tokio::fs::read_to_string(&record_file).await else {
+ return false;
+ };
+
+ matches!(contents.trim().to_lowercase().as_str(), "true")
+}
+
+pub async fn sign_vault_modified(modified: bool) {
+ let Some(current_dir) = current_local_path() else {
+ return;
+ };
+
+ let record_file = current_dir.join(CLIENT_FILE_VAULT_MODIFIED);
+
+ let contents = if modified { "true" } else { "false" };
+
+ let _ = tokio::fs::write(&record_file, contents).await;
+}