Skip to content

Commit 9883fc0

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 7537fe9 commit 9883fc0

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
@@ -2002,7 +2002,17 @@ def _build_processor_recording_context(self, run_dir) -> dict:
20022002
return ctx
20032003

20042004
def _final_processor_recording_context(self) -> dict:
2005-
context = dict(self._processor_recording_context or {})
2005+
cached = self._processor_recording_context
2006+
2007+
run_dir = None
2008+
if cached is not None:
2009+
run_dir = cached.get("run_dir")
2010+
if run_dir is None:
2011+
run_dir = getattr(self._rec_manager, "run_dir", None)
2012+
2013+
context = self._build_processor_recording_context(run_dir)
2014+
if cached is not None:
2015+
context.update(cached)
20062016

20072017
try:
20082018
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)