diff --git a/bin/src/qmdl_store.rs b/bin/src/qmdl_store.rs index d33c2b5..f6741f6 100644 --- a/bin/src/qmdl_store.rs +++ b/bin/src/qmdl_store.rs @@ -120,19 +120,17 @@ impl RecordingStore { fs::create_dir_all(&path) .await .map_err(RecordingStoreError::OpenDirError)?; - let mut manifest_file = File::create(&manifest_path) - .await - .map_err(RecordingStoreError::WriteManifestError)?; - let empty_manifest = Manifest { - entries: Vec::new(), + + let mut store = RecordingStore { + path: manifest_path, + manifest: Manifest { + entries: Vec::new() + }, + current_entry: None, }; - let empty_manifest_contents = - toml::to_string_pretty(&empty_manifest).expect("failed to serialize manifest"); - manifest_file - .write_all(empty_manifest_contents.as_bytes()) - .await - .map_err(RecordingStoreError::WriteManifestError)?; - RecordingStore::load(path).await + + store.write_manifest().await?; + Ok(store) } async fn read_manifest
(path: P) -> Result