mirror of
https://github.com/hydralauncher/hydra.git
synced 2025-01-23 21:44:55 +03:00
refactor: process watcher commands
This commit is contained in:
parent
5222d319a3
commit
4f7255a8d9
@ -8,10 +8,8 @@ import axios from "axios";
|
|||||||
import { exec } from "child_process";
|
import { exec } from "child_process";
|
||||||
|
|
||||||
const commands = {
|
const commands = {
|
||||||
findWineDir: () =>
|
findWineDir: `lsof -c wine 2>/dev/null | grep '/drive_c/windows$' | head -n 1 | awk '{for(i=9;i<=NF;i++) printf "%s ", $i; print ""}'`,
|
||||||
`lsof -c wine 2>/dev/null | grep '/drive_c/windows$' | head -n 1 | awk '{for(i=9;i<=NF;i++) printf "%s ", $i; print ""}'`,
|
findWineExecutables: `lsof -c wine 2>/dev/null | grep '\\.exe$' | awk '{for(i=9;i<=NF;i++) printf "%s ", $i; print ""}'`,
|
||||||
findWineExecutables: () =>
|
|
||||||
`lsof -c wine 2>/dev/null | grep '\\.exe$' | awk '{for(i=9;i<=NF;i++) printf "%s ", $i; print ""}'`,
|
|
||||||
};
|
};
|
||||||
|
|
||||||
export const gamesPlaytime = new Map<
|
export const gamesPlaytime = new Map<
|
||||||
@ -72,7 +70,7 @@ const findGamePathByProcess = (
|
|||||||
);
|
);
|
||||||
|
|
||||||
if (process.platform === "linux") {
|
if (process.platform === "linux") {
|
||||||
exec(commands.findWineDir(), (err, out) => {
|
exec(commands.findWineDir, (err, out) => {
|
||||||
if (err) return;
|
if (err) return;
|
||||||
|
|
||||||
gameRepository.update(
|
gameRepository.update(
|
||||||
@ -106,7 +104,7 @@ const getSystemProcessMap = async () => {
|
|||||||
|
|
||||||
if (process.platform === "linux") {
|
if (process.platform === "linux") {
|
||||||
await new Promise((res) => {
|
await new Promise((res) => {
|
||||||
exec(commands.findWineExecutables(), (err, out) => {
|
exec(commands.findWineExecutables, (err, out) => {
|
||||||
if (err) {
|
if (err) {
|
||||||
res(null);
|
res(null);
|
||||||
return;
|
return;
|
||||||
|
Loading…
Reference in New Issue
Block a user