diff options
| author | 魏曹先生 <1992414357@qq.com> | 2026-02-05 22:35:05 +0800 |
|---|---|---|
| committer | 魏曹先生 <1992414357@qq.com> | 2026-02-05 22:35:05 +0800 |
| commit | 27f6414ad1ff451feb0044af62f37dc2a6255ffa (patch) | |
| tree | cb5693bc014cc8579dcf02a730fd4d2a5dfcf1a5 /legacy_data/src/data/user.rs | |
| parent | ade2fcb9302a4ab759795820dbde3b2b269490ee (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/user.rs')
| -rw-r--r-- | legacy_data/src/data/user.rs | 28 |
1 files changed, 28 insertions, 0 deletions
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<Self> { + 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<P: Into<PathBuf>>(path: P) -> Option<Self> { + let local_path = path.into(); + if local_path.exists() { + Some(UserDirectory { local_path }) + } else { + None + } + } +} |
