feat: current state
This commit is contained in:
+23
-2
@@ -1,2 +1,23 @@
|
||||
pub struct AppPaths;
|
||||
impl AppPaths { pub fn discover() -> Self { Self } }
|
||||
use crate::error::{AppError, SafeError};
|
||||
use directories::ProjectDirs;
|
||||
use std::path::PathBuf;
|
||||
|
||||
#[derive(Debug, Clone)]
|
||||
pub struct AppPaths {
|
||||
config_dir: PathBuf,
|
||||
}
|
||||
impl AppPaths {
|
||||
pub fn discover() -> Result<Self, AppError> {
|
||||
let dirs = ProjectDirs::from("com", "azure", "azure-database-tui").ok_or_else(|| {
|
||||
AppError(SafeError::configuration(
|
||||
"Application configuration directory is unavailable",
|
||||
))
|
||||
})?;
|
||||
Ok(Self {
|
||||
config_dir: dirs.config_dir().to_path_buf(),
|
||||
})
|
||||
}
|
||||
pub fn profiles_path(&self) -> PathBuf {
|
||||
self.config_dir.join("profiles.json")
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user