Skip to content

Commit

Permalink
fix cwd for gameserver
Browse files Browse the repository at this point in the history
  • Loading branch information
joneugster committed Dec 8, 2023
1 parent 13d54ff commit cb72249
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions server/index.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -95,10 +95,11 @@ function startServerProcess(owner, repo) {
let serverProcess
if (isDevelopment) {
let args = ["--server", game_dir]
let executable = path.join(game_dir, ".lake", "packages", "GameServer", "server", ".lake", "build", "bin", "gameserver")
if (fs.existsSync(executable)) {
let binDir = path.join(game_dir, ".lake", "packages", "GameServer", "server", ".lake", "build", "bin")
// Note: `cwd` is important to be the `bin` directory as `Watchdog` calls `./gameserver` again
if (fs.existsSync(binDir)) {
// Try to use the game's own copy of `gameserver`.
serverProcess = cp.spawn(executable, args, { cwd: game_dir })
serverProcess = cp.spawn("./gameserver", args, { cwd: binDir })
} else {
// If the game is built with `-Klean4game.local` there is no copy in the lake packages.
serverProcess = cp.spawn("./gameserver", args,
Expand Down

0 comments on commit cb72249

Please sign in to comment.