pub struct EnvelopePaths { /* private fields */ }Expand description
Manages all paths used by EnvelopeCLI
Implementations§
Source§impl EnvelopePaths
impl EnvelopePaths
Sourcepub fn new() -> Result<Self, EnvelopeError>
pub fn new() -> Result<Self, EnvelopeError>
Create a new EnvelopePaths instance using XDG directories
§Errors
Returns an error if the home directory cannot be determined.
Sourcepub fn with_base_dir(base_dir: PathBuf) -> Self
pub fn with_base_dir(base_dir: PathBuf) -> Self
Create EnvelopePaths with a custom base directory (useful for testing)
Sourcepub fn config_dir(&self) -> PathBuf
pub fn config_dir(&self) -> PathBuf
Get the config directory (same as base for simplicity)
Sourcepub fn backup_dir(&self) -> PathBuf
pub fn backup_dir(&self) -> PathBuf
Get the backup directory (~/.envelope/backups/)
Sourcepub fn settings_file(&self) -> PathBuf
pub fn settings_file(&self) -> PathBuf
Get the path to the settings file
Sourcepub fn accounts_file(&self) -> PathBuf
pub fn accounts_file(&self) -> PathBuf
Get the path to accounts.json
Sourcepub fn transactions_file(&self) -> PathBuf
pub fn transactions_file(&self) -> PathBuf
Get the path to transactions.json
Sourcepub fn budget_file(&self) -> PathBuf
pub fn budget_file(&self) -> PathBuf
Get the path to budget.json (categories and groups)
Sourcepub fn allocations_file(&self) -> PathBuf
pub fn allocations_file(&self) -> PathBuf
Get the path to allocations.json (budget allocations per period)
Sourcepub fn payees_file(&self) -> PathBuf
pub fn payees_file(&self) -> PathBuf
Get the path to payees.json
Sourcepub fn targets_file(&self) -> PathBuf
pub fn targets_file(&self) -> PathBuf
Get the path to targets.json (budget targets)
Sourcepub fn ensure_directories(&self) -> Result<(), EnvelopeError>
pub fn ensure_directories(&self) -> Result<(), EnvelopeError>
Ensure all required directories exist
Creates:
- Base directory (~/.envelope/)
- Data directory (~/.envelope/data/)
- Backup directory (~/.envelope/backups/)
Sourcepub fn is_initialized(&self) -> bool
pub fn is_initialized(&self) -> bool
Check if EnvelopeCLI has been initialized (config file exists)
Trait Implementations§
Source§impl Clone for EnvelopePaths
impl Clone for EnvelopePaths
Source§fn clone(&self) -> EnvelopePaths
fn clone(&self) -> EnvelopePaths
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl Freeze for EnvelopePaths
impl RefUnwindSafe for EnvelopePaths
impl Send for EnvelopePaths
impl Sync for EnvelopePaths
impl Unpin for EnvelopePaths
impl UnwindSafe for EnvelopePaths
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more