Skip to content

Commit 4462c42

Browse files
authored
Merge pull request #24 from Rust-GPU/fix/standardize-linkage-paths-with-forward-slashes
fix: standardize linkage paths with forward slashes
2 parents abe597f + e333f9f commit 4462c42

File tree

1 file changed

+8
-2
lines changed
  • crates/spirv-builder-cli/src

1 file changed

+8
-2
lines changed

crates/spirv-builder-cli/src/lib.rs

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,15 +3,21 @@
33
/// Shader source and entry point that can be used to create shader linkage.
44
#[derive(serde::Serialize, Debug, PartialEq, Eq, PartialOrd, Ord)]
55
pub struct Linkage {
6-
pub source_path: std::path::PathBuf,
6+
pub source_path: String,
77
pub entry_point: String,
88
pub wgsl_entry_point: String,
99
}
1010

1111
impl Linkage {
1212
pub fn new(entry_point: impl AsRef<str>, source_path: impl AsRef<std::path::Path>) -> Self {
1313
Self {
14-
source_path: source_path.as_ref().to_path_buf(),
14+
// Force a forward slash convention here so it works on all OSs
15+
source_path: source_path
16+
.as_ref()
17+
.components()
18+
.map(|c| c.as_os_str().to_string_lossy())
19+
.collect::<Vec<_>>()
20+
.join("/"),
1521
wgsl_entry_point: entry_point.as_ref().replace("::", ""),
1622
entry_point: entry_point.as_ref().to_string(),
1723
}

0 commit comments

Comments
 (0)