This commit is contained in:
decolua
2026-04-06 17:32:44 +07:00
parent 7db4b9834e
commit 307be3b63d
18 changed files with 406 additions and 179 deletions
+12 -4
View File
@@ -12,15 +12,23 @@ const execAsync = promisify(exec);
const getDroidDir = () => path.join(os.homedir(), ".factory");
const getDroidSettingsPath = () => path.join(getDroidDir(), "settings.json");
// Check if droid CLI is installed
// Check if droid CLI is installed (via which/where or config file exists)
const checkDroidInstalled = async () => {
try {
const isWindows = os.platform() === "win32";
const command = isWindows ? "where droid" : "command -v droid";
await execAsync(command, { windowsHide: true });
const command = isWindows ? "where droid" : "which droid";
const env = isWindows
? { ...process.env, PATH: `${process.env.APPDATA}\\npm;${process.env.PATH}` }
: process.env;
await execAsync(command, { windowsHide: true, env });
return true;
} catch {
return false;
try {
await fs.access(getDroidSettingsPath());
return true;
} catch {
return false;
}
}
};