Skip to content

armgit / Cap

Public Imported from GitHub
0

Open source Loom alternative. Beautiful, shareable screen recordings.

fixes

Richie McIlroy7a418a1a7fb7
diff --git a/apps/desktop/src-tauri/src/recordings_locations.rs b/apps/desktop/src-tauri/src/recordings_locations.rs
index d8ddd22b0..13f3c57ea 100644
--- a/apps/desktop/src-tauri/src/recordings_locations.rs
+++ b/apps/desktop/src-tauri/src/recordings_locations.rs
@@ -10,8 +10,7 @@ use tauri_specta::Event;
use tracing::{info, warn};
use crate::{
- ArcLock, RecordingState, editor_window::EditorInstances,
- general_settings::GeneralSettingsStore,
+ ArcLock, RecordingState, editor_window::EditorInstances, general_settings::GeneralSettingsStore,
};
/// Staging directory (inside the destination) used for cross-volume moves.
@@ -240,11 +239,10 @@ pub async fn migrate_recordings_to_current_dir(
let dest = dest.clone();
let src = project.clone();
- let result =
- tokio::task::spawn_blocking(move || move_project_dir(&src, &dest))
- .await
- .map_err(|e| format!("Move task failed: {e}"))
- .and_then(|r| r);
+ let result = tokio::task::spawn_blocking(move || move_project_dir(&src, &dest))
+ .await
+ .map_err(|e| format!("Move task failed: {e}"))
+ .and_then(|r| r);
match result {
Ok(new_path) => {
@@ -253,7 +251,9 @@ pub async fn migrate_recordings_to_current_dir(
}
Err(error) => {
warn!(?project, %error, "Migration: failed to move recording; kept in place");
- summary.failed.push(RecordingsMigrationFailure { name, error });
+ summary
+ .failed
+ .push(RecordingsMigrationFailure { name, error });
}
}
}
@@ -313,7 +313,10 @@ fn project_is_in_use(project: &Path, in_use: &HashSet<PathBuf>) -> bool {
}
}
cap_project::RecordingMetaInner::Instant(instant) => {
- matches!(instant, cap_project::InstantRecordingMeta::InProgress { .. })
+ matches!(
+ instant,
+ cap_project::InstantRecordingMeta::InProgress { .. }
+ )
}
},
// Unreadable meta is not proof of activity; old or partially written
@@ -390,7 +393,10 @@ fn copy_verify_delete(src: &Path, dest_dir: &Path, unique: &str) -> Result<PathB
// The copy is verified and in place; a failure to delete the source only
// leaves a duplicate behind, which is safe. Don't fail the migration.
if let Err(e) = std::fs::remove_dir_all(src) {
- warn!(?src, "Migration: copied project but failed to remove the original: {e}");
+ warn!(
+ ?src,
+ "Migration: copied project but failed to remove the original: {e}"
+ );
}
Ok(target)
@@ -410,8 +416,7 @@ fn copy_dir_recursive(src: &Path, dest: &Path) -> Result<(), String> {
if file_type.is_dir() {
copy_dir_recursive(&from, &to)?;
} else {
- std::fs::copy(&from, &to)
- .map_err(|e| format!("Failed to copy {from:?}: {e}"))?;
+ std::fs::copy(&from, &to).map_err(|e| format!("Failed to copy {from:?}: {e}"))?;
}
}
@@ -470,7 +475,10 @@ mod tests {
let project = make_project(
&src_dir,
"Test.cap",
- &[("recording-meta.json", "{}"), ("content/display.mp4", "vid")],
+ &[
+ ("recording-meta.json", "{}"),
+ ("content/display.mp4", "vid"),
+ ],
);
let moved = move_project_dir(&project, &dest_dir).unwrap();
@@ -491,7 +499,11 @@ mod tests {
std::fs::create_dir_all(&src_dir).unwrap();
std::fs::create_dir_all(&dest_dir).unwrap();
- make_project(&dest_dir, "Test.cap", &[("recording-meta.json", "existing")]);
+ make_project(
+ &dest_dir,
+ "Test.cap",
+ &[("recording-meta.json", "existing")],
+ );
let project = make_project(&src_dir, "Test.cap", &[("recording-meta.json", "incoming")]);
let moved = move_project_dir(&project, &dest_dir).unwrap();
@@ -582,7 +594,11 @@ mod tests {
fn dir_stats_detects_mismatch() {
let tmp = tempfile::tempdir().unwrap();
let a = make_project(tmp.path(), "a.cap", &[("recording-meta.json", "same")]);
- let b = make_project(tmp.path(), "b.cap", &[("recording-meta.json", "different!")]);
+ let b = make_project(
+ tmp.path(),
+ "b.cap",
+ &[("recording-meta.json", "different!")],
+ );
let c = make_project(tmp.path(), "c.cap", &[("recording-meta.json", "same")]);
assert_ne!(dir_stats(&a).unwrap(), dir_stats(&b).unwrap());
diff --git a/crates/enc-avfoundation/src/mp4.rs b/crates/enc-avfoundation/src/mp4.rs
index 1debef114..bc3cea69a 100644
--- a/crates/enc-avfoundation/src/mp4.rs
+++ b/crates/enc-avfoundation/src/mp4.rs
@@ -1777,9 +1777,9 @@ mod tests {
assert_duration_tracks_input(1000.0, 60, 1.2);
// Seeded-random rate: an arbitrary camera cadence nothing was tuned
// for.
- let random_fps = 5.0 + (0x5EEDu64.wrapping_mul(6364136223846793005) >> 11) as f64
- / (1u64 << 53) as f64
- * 995.0;
+ let random_fps = 5.0
+ + (0x5EEDu64.wrapping_mul(6364136223846793005) >> 11) as f64 / (1u64 << 53) as f64
+ * 995.0;
assert_duration_tracks_input(random_fps, 30, 1.5);
}