Files
rclone-ui/cli/lib/open.js
FTCHDandGitHub 7a62659323 v3
can’t innovate my ass 

Signed-off-by: FTCHD <144691102+FTCHD@users.noreply.github.com>
2025-12-07 18:42:44 +01:00

41 lines
1.1 KiB
JavaScript

import { spawn } from "node:child_process";
import { getPlatform } from "./platform.js";
import { getInstallPath } from "./detect.js";
export function openApp() {
const { isMac, isWindows, isLinux } = getPlatform();
const installPath = getInstallPath();
return new Promise((resolve, reject) => {
let child;
if (isMac) {
child = spawn("open", ["-a", "Rclone UI"], {
detached: true,
stdio: "ignore",
});
} else if (isWindows) {
child = spawn(installPath, [], {
detached: true,
stdio: "ignore",
shell: true,
});
} else if (isLinux) {
child = spawn(installPath, [], {
detached: true,
stdio: "ignore",
});
} else {
reject(new Error("Unsupported platform"));
return;
}
child.unref();
child.on("error", reject);
// Give it a moment to spawn, then resolve
setTimeout(() => resolve(), 500);
});
}