1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
use crate::SchemaPlugin;
use proto_core::{async_trait, Installable, ProtoError, Resolvable};
use std::path::PathBuf;

#[async_trait]
impl Installable<'_> for SchemaPlugin {
    fn get_archive_prefix(&self) -> Result<Option<String>, ProtoError> {
        if let Some(prefix) = &self.get_platform()?.archive_prefix {
            return Ok(Some(self.interpolate_tokens(prefix)));
        }

        Ok(None)
    }

    fn get_install_dir(&self) -> Result<PathBuf, ProtoError> {
        Ok(self.base_dir.join(self.get_resolved_version()))
    }

    fn should_unpack(&self) -> bool {
        self.schema.install.unpack
    }
}