diff options
| author | 魏曹先生 <1992414357@qq.com> | 2025-10-06 04:11:34 +0800 |
|---|---|---|
| committer | 魏曹先生 <1992414357@qq.com> | 2025-10-06 04:11:34 +0800 |
| commit | 87c3ec3fdcbd2294c3b9258d28ff47959e6eff68 (patch) | |
| tree | a601cb7e7d97917e4a79ae6db3698c8ecd31717c /crates/vcs_data/src/data/user.rs | |
| parent | ce4545a21d435d63827fb972406e749354ac687a (diff) | |
Move vcs crate to vcs_data for better separation of concerns
- Rename vcs crate to vcs_data to clearly define data layer
- Maintain all existing data structures and functionality
- Update dependencies to include action_system integration
- Preserve test structure in vcs_data_test directory
Diffstat (limited to 'crates/vcs_data/src/data/user.rs')
| -rw-r--r-- | crates/vcs_data/src/data/user.rs | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/crates/vcs_data/src/data/user.rs b/crates/vcs_data/src/data/user.rs new file mode 100644 index 0000000..0abd098 --- /dev/null +++ b/crates/vcs_data/src/data/user.rs @@ -0,0 +1,28 @@ +use crate::current::current_doc_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_doc_dir() -> Option<Self> { + Some(UserDirectory { + local_path: current_doc_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 + } + } +} |
