Skip to content

Commit f48a415

Browse files
committed
Fix Windows failures
1 parent fb0c28b commit f48a415

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

crates/ark_test/src/dummy_frontend.rs

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -450,8 +450,10 @@ impl DummyArkFrontend {
450450
let mut file = NamedTempFile::new().unwrap();
451451
write!(file, "{code}").unwrap();
452452

453+
// Use forward slashes for R compatibility on Windows (backslashes would be
454+
// interpreted as escape sequences in R strings)
455+
let path = file.path().to_string_lossy().replace('\\', "/");
453456
let url = ExtUrl::from_file_path(file.path()).unwrap();
454-
let path = url.path().to_string();
455457
let uri = url.to_string();
456458
let filename = file
457459
.path()
@@ -666,8 +668,10 @@ impl SourceFile {
666668
let mut file = NamedTempFile::new().unwrap();
667669
write!(file, "{code}").unwrap();
668670

671+
// Use forward slashes for R compatibility on Windows (backslashes would be
672+
// interpreted as escape sequences in R strings)
673+
let path = file.path().to_string_lossy().replace('\\', "/");
669674
let url = ExtUrl::from_file_path(file.path()).unwrap();
670-
let path = url.path().to_string();
671675
let uri = url.to_string();
672676

673677
// Extract file name

0 commit comments

Comments
 (0)