cueward-adapter-macos 0.5.0

macOS adapter for Cueward with Safari, Notes, Messages, Reminders, Calendar, Screenshot, Clipboard, and OCR integrations.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
//! Shared screenshot/cache and operation-lock directory.
//! Keep the historical path so existing workers continue to share the same locks.
use crate::MacosError;
use std::fs;

const CACHE_DIR: &str = ".cueward/cache/screenshots";

/// Ensure the existing cache directory without changing its ownership or path.
pub(crate) fn ensure_cache_dir() -> Result<String, MacosError> {
    let home = std::env::var("HOME").map_err(|_| MacosError::Other("HOME not set".into()))?;
    let dir = format!("{home}/{CACHE_DIR}");
    fs::create_dir_all(&dir)
        .map_err(|e| MacosError::Other(format!("failed to create {dir}: {e}")))?;
    Ok(dir)
}