Skip to content

armgit / Cap

Public Imported from GitHub
0

Open source Loom alternative. Beautiful, shareable screen recordings.

fix: scope export memory states to supported platforms

Richie McIlroy72d605a0774b
diff --git a/crates/utils/src/export_resources.rs b/crates/utils/src/export_resources.rs
index 810b1b506..9420c52fc 100644
--- a/crates/utils/src/export_resources.rs
+++ b/crates/utils/src/export_resources.rs
@@ -13,7 +13,9 @@ const STOP_PREFIX: &str = "Export stopped to protect your computer: ";
enum MemoryPressure {
#[default]
Unknown,
+ #[cfg(any(target_os = "macos", test))]
Normal,
+ #[cfg(any(target_os = "macos", test))]
Warning,
Critical,
}
@@ -118,10 +120,14 @@ impl ExportResources {
disk.description
));
}
- if matches!(
+ #[cfg(any(target_os = "macos", test))]
+ let memory_warning = matches!(
sample.memory,
MemoryPressure::Warning | MemoryPressure::Critical
- ) {
+ );
+ #[cfg(not(any(target_os = "macos", test)))]
+ let memory_warning = sample.memory == MemoryPressure::Critical;
+ if memory_warning {
warnings.push("Your computer is already under memory pressure. Close other applications before exporting.".to_string());
}
if warnings.is_empty() {