// conf-path.js
// Returns Conf options that always resolve to the real system AppData on Windows.
//
// Problem: When clauth runs inside an Electron app (e.g. Claude Desktop), %APPDATA%
// is sandboxed to a package-specific path. The daemon runs as a plain system process
// using the real %APPDATA%, so the two processes write/read different config files.
//
// Fix: On Windows, always build the path from %USERPROFILE% which is never sandboxed.
// On Mac/Linux Conf's default behavior is correct.

import os from "os";
import path from "path";

export function getConfOptions() {
  if (process.platform === "win32") {
    const userProfile = process.env.USERPROFILE || os.homedir();
    const cwd = path.join(userProfile, "AppData", "Roaming", "clauth-nodejs", "Config");
    return { projectName: "clauth", cwd };
  }
  return { projectName: "clauth" };
}
