diff --git a/CHANGELOG.md b/CHANGELOG.md index 0eea6519..0b2a5ef6 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -16,6 +16,8 @@ Version 2.0.0 - Replaced the per instance copy of the shared Factorio mods with symlinks. On Windows hard links are used instead due to the privileges requirements of symlinks. +- Changed the per instance scenario folder to be linked instead of + copied on instance creation. ### Breaking Changes diff --git a/client.js b/client.js index ba93aacc..4a04b31f 100644 --- a/client.js +++ b/client.js @@ -6,7 +6,6 @@ const child_process = require('child_process'); const path = require('path'); const syncRequest = require('sync-request'); const request = require("request"); -const ncp = require('ncp').ncp; const Rcon = require('rcon-client-fork').Rcon; const deepmerge = require("deepmerge"); const getMac = require('getmac').getMac; @@ -392,10 +391,9 @@ async function createInstance(config, args, instance) { console.log(`Creating ${instance.path()}`); await fs.ensureDir(instance.path()); await fs.ensureDir(instance.path("script-output")); - fs.mkdirSync(instance.path("scenarios")); - ncp("lib/scenarios", instance.path("scenarios"), err => { - if (err) console.error(err) - }); + let target = path.join("lib", "scenarios"); + let link = instance.path("scenarios"); + await fs.symlink(path.relative(path.dirname(link), target), link, 'junction'); fs.writeFileSync(instance.path("config.ini"), `[path]\r\n read-data=${ path.resolve(config.factorioDirectory, "data") }\r\n diff --git a/package.json b/package.json index ad580d9f..6943dbcd 100644 --- a/package.json +++ b/package.json @@ -55,7 +55,6 @@ "mkdirp": "^0.5.1", "mkdirp-promise": "^5.0.1", "moment": "^2.22.2", - "ncp": "^2.0.0", "needle": "^2.4.0", "node-factorio-api": "^0.3.8", "node-forge": "^0.7.1",