1
0
Fork 0
mirror of https://codeberg.org/icewind/haze.git synced 2026-06-04 01:24:09 +02:00

allow using release sources

This commit is contained in:
Robin Appelman 2026-02-27 22:01:44 +01:00
commit f569ca17e2
9 changed files with 1226 additions and 113 deletions

View file

@ -78,20 +78,25 @@ impl<'a> Mapping<'a> {
Ok(())
}
pub fn source(&self, id: &str, config: &HazeConfig) -> Utf8PathBuf {
pub fn source(&self, id: &str, config: &HazeConfig, source_root: &Utf8Path) -> Utf8PathBuf {
match self.source_type {
MappingSourceType::WorkDir => config.work_dir.join(id).join(self.source),
MappingSourceType::GlobalWorkDir => config.work_dir.join(self.source),
MappingSourceType::Sources => config.sources_root.join(self.source),
MappingSourceType::Sources => source_root.join(self.source),
MappingSourceType::Absolute => self.source.into(),
}
}
pub fn get_volume_arg(&self, id: &str, config: &HazeConfig) -> Option<String> {
pub fn get_volume_arg(
&self,
id: &str,
config: &HazeConfig,
source_root: &Utf8Path,
) -> Option<String> {
if !self.map {
return None;
}
let source = self.source(id, config);
let source = self.source(id, config, source_root);
Some(if self.read_only {
format!("{}:{}:ro", source, self.target)
} else {