Skip to content

Commit 4d9f496

Browse files
committed
Fix environment variable path separator handling for AXVISOR_VM_CONFIGS
1 parent 0dadbe9 commit 4d9f496

File tree

2 files changed

+9
-14
lines changed

2 files changed

+9
-14
lines changed

kernel/build.rs

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -42,18 +42,13 @@ struct ConfigFile {
4242
pub content: String,
4343
}
4444

45-
/// Gets the paths (semicolon-separated) from the `AXVISOR_VM_CONFIGS` environment variable.
45+
/// Gets the paths (colon-separated) from the `AXVISOR_VM_CONFIGS` environment variable.
4646
///
4747
/// Returns `None` if the environment variable is not set.
4848
fn get_config_paths() -> Option<Vec<OsString>> {
4949
env::var("AXVISOR_VM_CONFIGS")
5050
.ok()
51-
.map(|paths| {
52-
paths
53-
.split(';')
54-
.map(|s| OsString::from(s.trim()))
55-
.collect()
56-
})
51+
.map(|paths| env::split_paths(&paths).map(OsString::from).collect())
5752
}
5853

5954
/// Gets the paths and contents of the configuration files specified by the `AXVISOR_VM_CONFIGS` environment variable.

xtask/src/tbuld.rs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
use std::path::PathBuf;
1+
use std::{env, path::PathBuf};
22

33
use anyhow::Context as _;
44
use ostool::build::config::{Cargo, LogLevel};
@@ -85,12 +85,12 @@ impl Context {
8585
}
8686

8787
if !vm_config_paths.is_empty() {
88-
let value = vm_config_paths
89-
.iter()
90-
.map(|p| format!("{}", p.display()))
91-
.collect::<Vec<_>>()
92-
.join(";");
93-
cargo.env.insert("AXVISOR_VM_CONFIGS".to_string(), value);
88+
if let Ok(joined) = env::join_paths(&vm_config_paths) {
89+
cargo.env.insert(
90+
"AXVISOR_VM_CONFIGS".to_string(),
91+
joined.to_string_lossy().into_owned()
92+
);
93+
}
9494
}
9595

9696
Ok(cargo)

0 commit comments

Comments
 (0)