diff --git a/packages/lib/factorio/server.js b/packages/lib/factorio/server.js index 658e5a15..49da075a 100644 --- a/packages/lib/factorio/server.js +++ b/packages/lib/factorio/server.js @@ -554,7 +554,7 @@ class FactorioServer extends events.EventEmitter { this._stripRegExp = new RegExp( `(${escapeRegExp(this.writePath("temp", "currently-playing", path.sep))})|` + `(${escapeRegExp(this.writePath(path.sep))})|` + - `(\\.\\.\\.[${chars}]*?currently-playing\\${path.sep})`, + `(\\.\\.\\.[${escapeRegExp(chars)}]*?currently-playing\\${path.sep})`, "g" ); } diff --git a/test/lib/factorio/server.js b/test/lib/factorio/server.js index 533c2d9a..424b2f9b 100644 --- a/test/lib/factorio/server.js +++ b/test/lib/factorio/server.js @@ -170,6 +170,16 @@ describe("lib/factorio/server", function() { let writePath = path.join("temp", "test", "server"); let server = new libFactorio.FactorioServer(path.join("test", "file", "factorio"), writePath, {}); + describe("constructor()", function() { + it("should handle dashes in write path with strapPaths enabled", function() { + new libFactorio.FactorioServer( + path.join("test", "file", "factorio"), + path.join("temp", "test", "server-1"), + { stripPaths: true } + ); + }); + }); + describe(".init()", function() { it("should not throw on first call", async function() { await server.init();