diff --git a/core/screenshot.py b/core/screenshot.py index b3c0c6a..6dec639 100644 --- a/core/screenshot.py +++ b/core/screenshot.py @@ -53,7 +53,6 @@ class ScreenshotService: # Configuration self._auto_save: bool = True - self._save_path: Path = self._get_default_save_path() self._format: str = "PNG" self._quality: int = 95 # For JPEG self._history_size: int = 20 @@ -62,10 +61,13 @@ class ScreenshotService: self._history: deque = deque(maxlen=self._history_size) self._last_screenshot: Optional[Image.Image] = None - # Platform detection + # Platform detection - MUST be before _get_default_save_path() self._platform = platform.system().lower() self._use_pil = self._platform == "windows" + # Set save path AFTER platform detection + self._save_path: Path = self._get_default_save_path() + # Lazy init for capture backends self._pil_available: Optional[bool] = None self._pyautogui_available: Optional[bool] = None diff --git a/core/screenshot_secure.py b/core/screenshot_secure.py index b3c0c6a..6dec639 100644 --- a/core/screenshot_secure.py +++ b/core/screenshot_secure.py @@ -53,7 +53,6 @@ class ScreenshotService: # Configuration self._auto_save: bool = True - self._save_path: Path = self._get_default_save_path() self._format: str = "PNG" self._quality: int = 95 # For JPEG self._history_size: int = 20 @@ -62,10 +61,13 @@ class ScreenshotService: self._history: deque = deque(maxlen=self._history_size) self._last_screenshot: Optional[Image.Image] = None - # Platform detection + # Platform detection - MUST be before _get_default_save_path() self._platform = platform.system().lower() self._use_pil = self._platform == "windows" + # Set save path AFTER platform detection + self._save_path: Path = self._get_default_save_path() + # Lazy init for capture backends self._pil_available: Optional[bool] = None self._pyautogui_available: Optional[bool] = None diff --git a/core/screenshot_vulnerable.py b/core/screenshot_vulnerable.py index a4a1093..1eff642 100644 --- a/core/screenshot_vulnerable.py +++ b/core/screenshot_vulnerable.py @@ -55,7 +55,6 @@ class ScreenshotService: # Configuration self._auto_save: bool = True - self._save_path: Path = self._get_default_save_path() self._format: str = "PNG" self._quality: int = 95 # For JPEG self._history_size: int = 20 @@ -64,10 +63,13 @@ class ScreenshotService: self._history: deque = deque(maxlen=self._history_size) self._last_screenshot = None - # Platform detection + # Platform detection - MUST be before _get_default_save_path() self._platform = platform.system().lower() self._use_pil = self._platform == "windows" + # Set save path AFTER platform detection + self._save_path: Path = self._get_default_save_path() + # Lazy init for capture backends self._pil_available: Optional[bool] = None self._pyautogui_available: Optional[bool] = None