use std::path::PathBuf;
use crate::{error::InstallerError, os::AccessScope, path::AppPathPrefix};
#[derive(Debug, Clone, Default)]
#[non_exhaustive]
pub struct InstallConfig {
pub access_scope: AccessScope,
pub destination: AppPathPrefix,
pub source_dir: PathBuf,
pub modify_os_search_path: bool,
}
impl InstallConfig {
pub fn new_user() -> Result<Self, InstallerError> {
Ok(Self {
access_scope: AccessScope::User,
destination: AppPathPrefix::User,
source_dir: crate::os::current_exe_dir()?,
modify_os_search_path: true,
})
}
pub fn new_system() -> Result<Self, InstallerError> {
Ok(Self {
access_scope: AccessScope::System,
destination: AppPathPrefix::System,
source_dir: crate::os::current_exe_dir()?,
modify_os_search_path: true,
})
}
}