Skip to content

armgit / Cap

Public Imported from GitHub
0

Open source Loom alternative. Beautiful, shareable screen recordings.

test(recovery): open the segments directory with backup semantics on Windows

Aatman Jain (AJ)1d7d2269a5b2
diff --git a/crates/recording/src/recovery.rs b/crates/recording/src/recovery.rs
index 4fc32bfeb..1a067a56e 100644
--- a/crates/recording/src/recovery.rs
+++ b/crates/recording/src/recovery.rs
@@ -5395,7 +5395,19 @@ mod transactional_recovery_tests {
});
std::fs::write(segments.join("._raw.m4s"), b"\x00\x05\x16\x07").unwrap();
- std::fs::File::open(&segments)
+ let mut directory = std::fs::OpenOptions::new();
+ directory.read(true);
+ #[cfg(windows)]
+ {
+ use std::os::windows::fs::OpenOptionsExt;
+ const FILE_WRITE_ATTRIBUTES: u32 = 0x0100;
+ const FILE_FLAG_BACKUP_SEMANTICS: u32 = 0x0200_0000;
+ directory
+ .access_mode(FILE_WRITE_ATTRIBUTES)
+ .custom_flags(FILE_FLAG_BACKUP_SEMANTICS);
+ }
+ directory
+ .open(&segments)
.unwrap()
.set_times(std::fs::FileTimes::new().set_modified(modified))
.unwrap();