Skip to content

Commit 1cdd4cb

Browse files
authored
use native delimiter on Windows (#18)
We need to use ';', not ':' when separating directory names on Windows. Signed-off-by: Joel Dice <[email protected]>
1 parent 00e7729 commit 1cdd4cb

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

crates/spin-python-cli/src/main.rs

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,12 @@ use {
1515
zstd::Decoder,
1616
};
1717

18+
#[cfg(unix)]
19+
const NATIVE_PATH_DELIMITER: char = ':';
20+
21+
#[cfg(windows)]
22+
const NATIVE_PATH_DELIMITER: char = ';';
23+
1824
/// A Spin plugin to convert Python apps to Spin-compatible WebAssembly modules
1925
#[derive(Parser, Debug)]
2026
#[command(author, version, about, name = "py2wasm")]
@@ -62,7 +68,7 @@ fn main() -> Result<()> {
6268

6369
let python_path = options
6470
.python_path
65-
.split(':')
71+
.split(NATIVE_PATH_DELIMITER)
6672
.enumerate()
6773
.map(|(index, path)| {
6874
let index = index.to_string();
@@ -98,7 +104,7 @@ fn main() -> Result<()> {
98104
let mut python_path = options.python_path;
99105
if let Some(site_packages) = find_site_packages()? {
100106
python_path = format!(
101-
"{python_path}:{}",
107+
"{python_path}{NATIVE_PATH_DELIMITER}{}",
102108
site_packages
103109
.to_str()
104110
.context("non-UTF-8 site-packages name")?

0 commit comments

Comments
 (0)