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 runtime_dir: PathBuf,
pub shims_dir: PathBuf,
pub sessions_dir: PathBuf,
pub global_dir: PathBuf,
}
pub fn home_paths(home: &Path, runtime_root: &Path) -> HomePaths {
HomePaths {
home: home.to_path_buf(),
registry_dir: home.join("registry"),
plugins_dir: home.join("plugins"),
cache_dir: home.join("cache"),
runtime_dir: runtime_root.to_path_buf(),
shims_dir: home.join("shims"),
sessions_dir: home.join("sessions"),
global_dir: home.join("global"),
}
}
pub fn install_dir(runtime_root: &Path, plugin: &str, version: &str) -> PathBuf {
runtime_root.join(plugin).join("versions").join(version)
}
pub fn global_current_dir(runtime_root: &Path, plugin: &str) -> PathBuf {
runtime_root.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")
}