Skip to content

Commit 119e72a

Browse files
committed
normalize path separators in Twig to forward slashes
1 parent 90c0954 commit 119e72a

2 files changed

Lines changed: 6 additions & 6 deletions

File tree

crates/bough-core/src/mutant.rs

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -216,11 +216,7 @@ impl<'a, R: bough_fs::Root> BasedMutant<'a, R> {
216216
impl HashInto for Mutant {
217217
fn hash_into(&self, state: &mut bough_typed_hash::ShaState) -> Result<(), std::io::Error> {
218218
self.lang.hash_into(state)?;
219-
self.twig
220-
.path()
221-
.as_os_str()
222-
.as_encoded_bytes()
223-
.hash_into(state)?;
219+
self.twig.as_str().as_bytes().hash_into(state)?;
224220
self.subst_span.hash_into(state)?;
225221
self.kind.hash_into(state)?;
226222
Ok(())

crates/bough-fs/src/twig.rs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,12 +12,16 @@ impl Twig {
1212
let s = path
1313
.to_str()
1414
.ok_or_else(|| Error::TwigNotUtf8(path.clone()))?;
15-
Ok(Self(s.to_owned()))
15+
Ok(Self(s.replace('\\', "/")))
1616
}
1717

1818
pub fn path(&self) -> &Path {
1919
Path::new(&self.0)
2020
}
21+
22+
pub fn as_str(&self) -> &str {
23+
&self.0
24+
}
2125
}
2226

2327
#[cfg(test)]

0 commit comments

Comments
 (0)