Prefer phone Downloads for saved face detector captures.
()
| 281 | seen = set() |
| 282 | for root in candidates: |
| 283 | if not root or root in seen: |
| 284 | continue |
| 285 | seen.add(root) |
| 286 | try: |
| 287 | os.makedirs(root, exist_ok=True) |
| 288 | if os.path.isdir(root) and os.access(root, os.W_OK): |
| 289 | return root |
| 290 | except Exception: |
| 291 | continue |
| 292 | |
| 293 | # Fallback (non-persistent): still run, but data may be lost on uninstall |
| 294 | fallback = os.path.join(HOME, "Homework") |
| 295 | try: |
| 296 | os.makedirs(fallback, exist_ok=True) |
| 297 | except Exception: |
| 298 | pass |
| 299 | return fallback |
| 300 | |
| 301 | def _choose_face_detector_output_dir() -> str: |
| 302 | """Prefer phone Downloads for saved face detector captures.""" |
| 303 | candidates = [] |
| 304 | shared = _termux_shared_root() |
| 305 | if shared: |
| 306 | candidates.append(os.path.join(shared, "Download", "ButSystem", "Face Detector")) |
| 307 | candidates.append(os.path.join(shared, "Downloads", "ButSystem", "Face Detector")) |
| 308 | candidates.append(os.path.join(HOME, "storage", "downloads", "ButSystem", "Face Detector")) |
| 309 | candidates.append(os.path.join(HOME, "Downloads", "ButSystem", "Face Detector")) |
| 310 | candidates.append(os.path.join(HOME, "ButSystem", "Face Detector")) |
| 311 | |
| 312 | seen = set() |
| 313 | for root in candidates: |
no test coverage detected