Skip to content

Commit 937b21b

Browse files
committed
Fix save path and recording context resolution
Improve processor metadata finalization by rebuilding recording context from the current run directory and then overlaying cached values, so missing fields are backfilled before merging file context. Also update socket processor saving so explicitly provided relative filenames are saved under the `data/` directory, matching expected output behavior.
1 parent 5220667 commit 937b21b

2 files changed

Lines changed: 15 additions & 1 deletion

File tree

‎dlclivegui/gui/main_window.py‎

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2008,7 +2008,17 @@ def _build_processor_recording_context(self, run_dir) -> dict:
20082008
return ctx
20092009

20102010
def _final_processor_recording_context(self) -> dict:
2011-
context = dict(self._processor_recording_context or {})
2011+
cached = self._processor_recording_context
2012+
2013+
run_dir = None
2014+
if cached is not None:
2015+
run_dir = cached.get("run_dir")
2016+
if run_dir is None:
2017+
run_dir = getattr(self._rec_manager, "run_dir", None)
2018+
2019+
context = self._build_processor_recording_context(run_dir)
2020+
if cached is not None:
2021+
context.update(cached)
20122022

20132023
try:
20142024
final_file_context = self._rec_manager.get_recording_file_context()

‎dlclivegui/processors/dlc_processor_socket.py‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -376,6 +376,7 @@ def _clear_data_queues(self):
376376

377377
def save(self, file=None):
378378
target = file
379+
explicit_file = file is not None
379380

380381
if target is None:
381382
target = getattr(self, "save_path", None)
@@ -387,6 +388,9 @@ def save(self, file=None):
387388
try:
388389
save_dict = self.get_data()
389390
save_path = Path(target)
391+
if explicit_file and not save_path.is_absolute():
392+
save_path = Path("data") / save_path
393+
390394
save_path.parent.mkdir(parents=True, exist_ok=True)
391395

392396
if self.save_original:

0 commit comments

Comments
 (0)