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
Path resolution:
ENVELOPE_CLI_DATA_DIRenv var (explicit override)- Unix:
$XDG_CONFIG_HOME/envelope-clior~/.config/envelope-cli - Windows:
%APPDATA%\envelope-cli
§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 base_dir(&self) -> &PathBuf
pub fn base_dir(&self) -> &PathBuf
Get the base directory (~/.config/envelope-cli/ or equivalent)
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 (~/.config/envelope-cli/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 income_file(&self) -> PathBuf
pub fn income_file(&self) -> PathBuf
Get the path to income.json (income expectations)
Sourcepub fn ensure_directories(&self) -> Result<(), EnvelopeError>
pub fn ensure_directories(&self) -> Result<(), EnvelopeError>
Ensure all required directories exist
Creates:
- Base directory (~/.config/envelope-cli/)
- Data directory (~/.config/envelope-cli/data/)
- Backup directory (~/.config/envelope-cli/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
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
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
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>
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>
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