Link lib/scenarios instead of copying it

Link the instance directory's scenario folder to lib/scenarios instead
of copying it.  This ensures it stays up to date.
This commit is contained in:
Hornwitser committed 2019-10-14 15:51:45 +02:00
1 parent cbcf868c9e
commit 33e9f9d983
3 files changed
+5 -6

No files matched your search

+2
View File
@@ -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
+3 -5
View File
@@ -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
-1
View File
@@ -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",