From 87c3ec3fdcbd2294c3b9258d28ff47959e6eff68 Mon Sep 17 00:00:00 2001 From: 魏曹先生 <1992414357@qq.com> Date: Mon, 6 Oct 2025 04:11:34 +0800 Subject: 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 --- crates/vcs_data/src/data/user.rs | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 crates/vcs_data/src/data/user.rs (limited to 'crates/vcs_data/src/data/user.rs') 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 { + 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>(path: P) -> Option { + let local_path = path.into(); + if local_path.exists() { + Some(UserDirectory { local_path }) + } else { + None + } + } +} -- cgit