From 620cf0597ee2ce3f6c45dd95402fb0446b7648eb Mon Sep 17 00:00:00 2001 From: Alexander Bentkamp Date: Tue, 13 Jun 2023 11:44:09 +0200 Subject: [PATCH] add path for local game --- server/index.mjs | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/server/index.mjs b/server/index.mjs index acdf9f0..967f5e8 100644 --- a/server/index.mjs +++ b/server/index.mjs @@ -27,10 +27,12 @@ const games = { // name: "NNG", dir: "../../../../NNG4", queueLength: 5 + }, + "g/local/game": { + dir: "../../../../game", + queueLength: 5 } } -// Note: If `module` and `name` are uncommented, one also needs to add them as arguments to -// the `--server` call below. const __filename = url.fileURLToPath(import.meta.url); const __dirname = url.fileURLToPath(new URL('.', import.meta.url)); @@ -62,8 +64,12 @@ const queue = {} function startServerProcess(tag) { let serverProcess if (isDevelopment && games[tag]?.dir) { - serverProcess = cp.spawn("./gameserver", - ["--server", games[tag].dir], // games[tag].module, games[tag].name + let args = ["--server", games[tag].dir] + if (games[tag].module) { + args.push(games[tag].module) + if (games[tag].name) { args.push(games[tag].name) } + } + serverProcess = cp.spawn("./gameserver", args, { cwd: "./build/bin/" }) } else { serverProcess = cp.spawn("docker",