fix: handle Windows paths in pre-commit tests (#2974)

Co-authored-by: houseme <housemecn@gmail.com>
This commit is contained in:
Henry Guo
2026-05-15 22:04:51 +08:00
committed by GitHub
parent 738fb86611
commit bca8b08c2b
15 changed files with 134 additions and 46 deletions
+1 -1
View File
@@ -287,7 +287,7 @@ mod tests {
#[cfg(not(target_os = "linux"))]
{
// Non-Linux should return UnsupportedPlatform
let file = std::fs::File::open("/dev/null").unwrap();
let file = std::fs::File::open(std::env::current_exe().unwrap()).unwrap();
assert!(matches!(DirectIoReader::new(file, 0, 512), Err(DirectIoError::UnsupportedPlatform)));
}
}
+9
View File
@@ -219,6 +219,15 @@ pub fn detect_storage_media(storage_detection_enabled: bool, storage_media_overr
}
}
#[cfg(not(any(target_os = "linux", target_os = "macos")))]
{
if let Ok(media) = detect_platform_storage_media()
&& media != StorageMedia::Unknown
{
return media;
}
}
StorageMedia::Unknown
}