mirror of
https://github.com/hydralauncher/hydra.git
synced 2025-02-09 03:37:45 +03:00
use app.isPackaged directly inside getProcesses function
This commit is contained in:
parent
9b9eabd801
commit
a4edff3619
@ -4,13 +4,12 @@ import { gameRepository } from "@main/repository";
|
|||||||
|
|
||||||
import { registerEvent } from "../register-event";
|
import { registerEvent } from "../register-event";
|
||||||
import { getProcesses } from "@main/helpers";
|
import { getProcesses } from "@main/helpers";
|
||||||
import { app } from "electron";
|
|
||||||
|
|
||||||
const closeGame = async (
|
const closeGame = async (
|
||||||
_event: Electron.IpcMainInvokeEvent,
|
_event: Electron.IpcMainInvokeEvent,
|
||||||
gameId: number
|
gameId: number
|
||||||
) => {
|
) => {
|
||||||
const processes = await getProcesses(app.isPackaged);
|
const processes = await getProcesses();
|
||||||
const game = await gameRepository.findOne({ where: { id: gameId } });
|
const game = await gameRepository.findOne({ where: { id: gameId } });
|
||||||
|
|
||||||
const gameProcess = processes.find((runningProcess) => {
|
const gameProcess = processes.find((runningProcess) => {
|
||||||
|
@ -2,13 +2,14 @@ import psList from "ps-list";
|
|||||||
import path from "node:path";
|
import path from "node:path";
|
||||||
import childProcess from "node:child_process";
|
import childProcess from "node:child_process";
|
||||||
import { promisify } from "node:util";
|
import { promisify } from "node:util";
|
||||||
|
import { app } from "electron";
|
||||||
|
|
||||||
const TEN_MEGABYTES = 1000 * 1000 * 10;
|
const TEN_MEGABYTES = 1000 * 1000 * 10;
|
||||||
const execFile = promisify(childProcess.execFile);
|
const execFile = promisify(childProcess.execFile);
|
||||||
|
|
||||||
export const getProcesses = async (isPackaged: boolean) => {
|
export const getProcesses = async () => {
|
||||||
if (process.platform == "win32") {
|
if (process.platform == "win32") {
|
||||||
const binaryPath = isPackaged
|
const binaryPath = app.isPackaged
|
||||||
? path.join(process.resourcesPath, "dist", "fastlist.exe")
|
? path.join(process.resourcesPath, "dist", "fastlist.exe")
|
||||||
: path.join(__dirname, "..", "..", "resources", "dist", "fastlist.exe");
|
: path.join(__dirname, "..", "..", "resources", "dist", "fastlist.exe");
|
||||||
|
|
||||||
|
@ -4,7 +4,6 @@ import { IsNull, Not } from "typeorm";
|
|||||||
import { gameRepository } from "@main/repository";
|
import { gameRepository } from "@main/repository";
|
||||||
import { getProcesses } from "@main/helpers";
|
import { getProcesses } from "@main/helpers";
|
||||||
import { WindowManager } from "./window-manager";
|
import { WindowManager } from "./window-manager";
|
||||||
import { app } from "electron";
|
|
||||||
|
|
||||||
const sleep = (ms: number) => new Promise((resolve) => setTimeout(resolve, ms));
|
const sleep = (ms: number) => new Promise((resolve) => setTimeout(resolve, ms));
|
||||||
|
|
||||||
@ -26,7 +25,7 @@ export const startProcessWatcher = async () => {
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
const processes = await getProcesses(app.isPackaged);
|
const processes = await getProcesses();
|
||||||
|
|
||||||
for (const game of games) {
|
for (const game of games) {
|
||||||
const basename = path.win32.basename(game.executablePath);
|
const basename = path.win32.basename(game.executablePath);
|
||||||
|
Loading…
Reference in New Issue
Block a user