Skip to content

Commit 46bb699

Browse files
committed
Resolve final pkgdir
1 parent 7f0ef0a commit 46bb699

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

src/package.rs

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
1-
use std::{collections::HashMap, fmt::Display, process::Command, str::FromStr, sync::LazyLock};
1+
use std::{
2+
collections::HashMap, env::current_dir, fmt::Display, process::Command, str::FromStr,
3+
sync::LazyLock,
4+
};
25

36
use anyhow::{anyhow, Result};
47
use camino::Utf8PathBuf;
@@ -113,15 +116,20 @@ impl Package {
113116
let mut package: Package = toml_edit::de::from_str(s)?;
114117

115118
let mut variables = HashMap::new();
119+
120+
let pkgdir = current_dir()?.join("package");
116121
variables.insert("version", package.info.version.as_str());
122+
variables.insert("pkgdir", pkgdir.to_str().unwrap()); // FIXME: horrible
117123

118124
for source in package.sources.iter_mut() {
119125
source.url = replace_vars(&source.url, &variables)
120126
}
121127

122128
for step in package.steps.iter_mut() {
123129
match &mut step.variant {
124-
StepVariant::Command { .. } => {}
130+
StepVariant::Command { command, .. } => {
131+
*command = replace_vars(command.as_str(), &variables).into();
132+
}
125133
StepVariant::Move { path } => {
126134
*path = replace_vars(path.as_str(), &variables).into();
127135
}

0 commit comments

Comments
 (0)