From 507c0afa983150fa691eacea965430b6ffe32e40 Mon Sep 17 00:00:00 2001 From: Danielv123 Date: Fri, 30 Mar 2018 11:07:26 +0200 Subject: [PATCH] factorioServer relative paths instead of absolute --- node_modules/_app/factorioServer/index.js | 8 ++++---- node_modules/_app/factorioServer/index.spec.js | 6 +++--- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/node_modules/_app/factorioServer/index.js b/node_modules/_app/factorioServer/index.js index a5f0ec87..1c8cde0d 100644 --- a/node_modules/_app/factorioServer/index.js +++ b/node_modules/_app/factorioServer/index.js @@ -129,10 +129,10 @@ module.exports = class factorioServer { this.onProgress("log", "Starting map creation"); console.log(this.factorioDirectory + '/bin/x64/factorio') let code = child_process.spawnSync( - path.resolve(this.factorioDirectory, 'bin', 'x64', 'factorio'), [ - '-c', path.resolve(this.instanceDirectory,'config.ini'), - '--create', path.resolve(this.instanceDirectory, 'saves',name), - '--server-settings', path.resolve(this.instanceDirectory, 'server-settings.json'), + path.join(this.factorioDirectory, 'bin', 'x64', 'factorio'), [ + '-c', path.join(this.instanceDirectory,'config.ini'), + '--create', path.join(this.instanceDirectory, 'saves',name), + '--server-settings', path.join(this.instanceDirectory, 'server-settings.json'), ],{ cwd:process.cwd(), } diff --git a/node_modules/_app/factorioServer/index.spec.js b/node_modules/_app/factorioServer/index.spec.js index 31087e81..1a829233 100644 --- a/node_modules/_app/factorioServer/index.spec.js +++ b/node_modules/_app/factorioServer/index.spec.js @@ -57,15 +57,15 @@ describe("factorioServer/index.js", ()=>{ it("creates a map file as instanceDirectory/saves/map.zip", async ()=>{ let relativePath = __dirname.replace(appRootPath, "").substr(1); let server = new factorioServer({ - instanceDirectory: path.resolve(relativePath, "_testData_createMap"), + instanceDirectory: path.join(relativePath, "_testData_createMap"), instanceName: "Unit testing instance", }); await server.initialize(); console.log("Relative path: "+relativePath) - let maps = fs.readdirSync(path.resolve(relativePath, "_testData_createMap", "saves")); + let maps = fs.readdirSync(path.join(relativePath, "_testData_createMap", "saves")); assert.equal(maps.length, 0); await server.createMap(); - let maps2 = fs.readdirSync(path.resolve(relativePath, "_testData_createMap", "saves")); + let maps2 = fs.readdirSync(path.join(relativePath, "_testData_createMap", "saves")); assert(maps2.includes("map.zip")); server.deleteInstance();