use std::path::{Path, PathBuf};
#[derive(Debug, Clone, PartialEq, Eq)]
pub struct HomePaths {
pub home: PathBuf,
pub registry_dir: PathBuf,
pub plugins_dir: PathBuf,
pub cache_dir: PathBuf,
pub shims_dir: PathBuf,
pub sessions_dir: PathBuf,
pub global_dir: PathBuf,
}
pub fn home_paths(home: &Path) -> HomePaths {
HomePaths {
home: home.to_path_buf(),
registry_dir: home.join("registry"),
plugins_dir: home.join("plugins"),
cache_dir: home.join("cache"),
shims_dir: home.join("shims"),
sessions_dir: home.join("sessions"),
global_dir: home.join("global"),
}
}
pub fn install_dir(home: &Path, plugin: &str, version: &str) -> PathBuf {
home.join("cache")
.join(plugin)
.join("versions")
.join(version)
}
pub fn global_current_dir(home: &Path, plugin: &str) -> PathBuf {
home.join("cache").join(plugin).join("current")
}
pub fn project_sdk_dir(project_root: &Path, plugin: &str) -> PathBuf {
project_root.join(".vs").join("sdks").join(plugin)
}
pub fn bin_dir(install_dir: &Path) -> PathBuf {
install_dir.join("bin")
}