From 27f6414ad1ff451feb0044af62f37dc2a6255ffa Mon Sep 17 00:00:00 2001 From: 魏曹先生 <1992414357@qq.com> Date: Thu, 5 Feb 2026 22:35:05 +0800 Subject: 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 --- legacy_data/src/data/user.rs | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 legacy_data/src/data/user.rs (limited to 'legacy_data/src/data/user.rs') diff --git a/legacy_data/src/data/user.rs b/legacy_data/src/data/user.rs new file mode 100644 index 0000000..a2326fa --- /dev/null +++ b/legacy_data/src/data/user.rs @@ -0,0 +1,28 @@ +use crate::env::current_cfg_dir; +use std::path::PathBuf; + +pub mod accounts; + +pub struct UserDirectory { + local_path: PathBuf, +} + +impl UserDirectory { + /// Create a user ditectory struct from the current system's document directory + pub fn current_cfg_dir() -> Option { + Some(UserDirectory { + local_path: current_cfg_dir()?, + }) + } + + /// Create a user directory struct from a specified directory path + /// Returns None if the directory does not exist + pub fn from_path>(path: P) -> Option { + let local_path = path.into(); + if local_path.exists() { + Some(UserDirectory { local_path }) + } else { + None + } + } +} -- cgit