Use a path object that supports setting a Thing for the data directory.

This allows us to ensure that arbitrary paths are not selected via the API.
This commit is contained in:
Julian Stirling 2026-06-02 12:57:46 +01:00
parent b9c6071bc7
commit 83ceb82ea8
5 changed files with 146 additions and 45 deletions

View file

@ -9,7 +9,6 @@ See repository root for licensing information.
import enum
import logging
import os
import time
from dataclasses import dataclass
from types import TracebackType
@ -737,7 +736,7 @@ class AutofocusThing(lt.Thing):
# Loop through the range, saving each capture to disk
for capture in captures[slice_to_save]:
path = os.path.join(capture_parameters.images_dir, capture.filename)
path = capture_parameters.images_dir.join(capture.filename)
self._cam.save_from_memory(path=path, buffer_id=capture.buffer_id)
self._cam.clear_buffers()
@ -956,7 +955,7 @@ class AutofocusThing(lt.Thing):
# Save all captures
for capture in captures:
path = os.path.join(capture_parameters.images_dir, capture.filename)
path = capture_parameters.images_dir.join(capture.filename)
self._cam.save_from_memory(path=path, buffer_id=capture.buffer_id)
self._cam.clear_buffers()