fix: handle quotes in game name

This commit is contained in:
Fhilipe Coelho 2024-04-12 00:05:55 -03:00
parent 8d5550a6a8
commit a9f621214b

View File

@ -24,6 +24,7 @@ const openGame = async (
if (fs.existsSync(gamePath)) { if (fs.existsSync(gamePath)) {
const setupPath = path.join(gamePath, "setup.exe"); const setupPath = path.join(gamePath, "setup.exe");
console.log(setupPath);
if (fs.existsSync(setupPath)) { if (fs.existsSync(setupPath)) {
if (process.platform === "win32") { if (process.platform === "win32") {
shell.openExternal(setupPath); shell.openExternal(setupPath);
@ -31,15 +32,16 @@ const openGame = async (
if (process.platform === "linux") { if (process.platform === "linux") {
if (spawnSync('which', ['lutris']).status === 0) { if (spawnSync('which', ['lutris']).status === 0) {
const ymlPath = path.join(gamePath, "setup.yml"); const ymlPath = path.join(gamePath, "setup.yml");
console.log(ymlPath)
await writeFile(ymlPath, generateYML(game)); await writeFile(ymlPath, generateYML(game));
const lutris = spawn('lutris', ['--install', `'${ymlPath}'`], { const lutris = spawn('lutris', ['--install', `"${ymlPath}"`], {
shell: true, shell: true,
detached: true, detached: true,
stdio: 'ignore' stdio: 'ignore'
}); });
lutris.unref(); lutris.unref();
} else { } else {
const wine = spawn('wine', [`'${setupPath}'`], { const wine = spawn('wine', [`"${setupPath}"`], {
shell: true, shell: true,
detached: true, detached: true,
stdio: 'ignore' stdio: 'ignore'