refactor: use path join in yml file

This commit is contained in:
Fhilipe Coelho 2024-04-11 14:39:12 -03:00
parent 729f3995fa
commit 54e29c12d4

View file

@ -1,13 +1,14 @@
import { Document as YMLDocument } from 'yaml'; import { Document as YMLDocument } from 'yaml';
import { Game } from '@main/entity'; import { Game } from '@main/entity';
import path from "node:path";
export function generateYML(game: Game) { export function generateYML(game: Game) {
const slugfiedName = game.title.replace(/\s/g, '-').toLocaleLowerCase(); const slugfiedGameTitle = game.title.replace(/\s/g, '-').toLocaleLowerCase();
const doc = new YMLDocument({ const doc = new YMLDocument({
name: game.title, name: game.title,
game_slug: slugfiedName, game_slug: slugfiedGameTitle,
slug: `${slugfiedName}-installer`, slug: `${slugfiedGameTitle}-installer`,
version: 'Installer', version: 'Installer',
runner: 'wine', runner: 'wine',
script: { script: {
@ -19,7 +20,7 @@ export function generateYML(game: Game) {
} }
}, { }, {
task: { task: {
executable: `${game.downloadPath}/${game.folderName}/setup.exe`, executable: path.join(game.downloadPath, game.folderName, 'setup.exe'),
name: "wineexec", name: "wineexec",
prefix: "$GAMEDIR/prefix" prefix: "$GAMEDIR/prefix"
} }