Skip to content

Commit 2f5fecd

Browse files
authored
Use recording name for file name when saving a file (#9982)
1 parent 25f0bf2 commit 2f5fecd

File tree

1 file changed

+10
-3
lines changed
  • crates/viewer/re_viewer/src

1 file changed

+10
-3
lines changed

crates/viewer/re_viewer/src/app.rs

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ use re_viewer_context::{
1616
AppOptions, AsyncRuntimeHandle, BlueprintUndoState, CommandReceiver, CommandSender,
1717
ComponentUiRegistry, DisplayMode, Item, PlayState, RecordingConfig, StorageContext,
1818
StoreContext, StoreHubEntry, SystemCommand, SystemCommandSender as _, TableStore, ViewClass,
19-
ViewClassRegistry, ViewClassRegistryError, command_channel,
19+
ViewClassRegistry, ViewClassRegistryError, command_channel, santitize_file_name,
2020
store_hub::{BlueprintPersistence, StoreHub, StoreHubStats},
2121
};
2222

@@ -2473,7 +2473,14 @@ fn save_recording(
24732473
.and_then(|info| info.store_version)
24742474
.unwrap_or(re_build_info::CrateVersion::LOCAL);
24752475

2476-
let file_name = "data.rrd";
2476+
let file_name = if let Some(recording_name) = entity_db
2477+
.recording_property::<re_types::components::Name>(
2478+
&re_types::archetypes::RecordingProperties::descriptor_name(),
2479+
) {
2480+
format!("{}.rrd", santitize_file_name(&recording_name))
2481+
} else {
2482+
"data.rrd".to_owned()
2483+
};
24772484

24782485
let title = if loop_selection.is_some() {
24792486
"Save loop selection"
@@ -2484,7 +2491,7 @@ fn save_recording(
24842491
save_entity_db(
24852492
app,
24862493
rrd_version,
2487-
file_name.to_owned(),
2494+
file_name,
24882495
title.to_owned(),
24892496
entity_db.to_messages(loop_selection),
24902497
)

0 commit comments

Comments
 (0)