mirror of
https://github.com/clusterio/clusterio.git
synced 2026-11-12 07:04:52 +09:00
Move clusterioMod file creation
Move the creation of the output.txt, orders.txt and txbuffer.txt script output files out of the client.js code and into the clusterioMod.
This commit is contained in:
1 parent
3202e2d150
commit
2ff52a1cf2
3 files changed
+10
-6
No files matched your search
@@ -331,9 +331,6 @@ async function createInstance(config, args, instance) {
|
||||
console.log("Creating instance...");
|
||||
fs.mkdirSync(instance.path());
|
||||
fs.mkdirSync(instance.path("script-output"));
|
||||
fs.writeFileSync(instance.path("script-output", "output.txt"), "");
|
||||
fs.writeFileSync(instance.path("script-output", "orders.txt"), "");
|
||||
fs.writeFileSync(instance.path("script-output", "txbuffer.txt"), "");
|
||||
fs.mkdirSync(instance.path("mods"));
|
||||
fs.mkdirSync(instance.path("instanceMods"));
|
||||
fs.mkdirSync(instance.path("scenarios"));
|
||||
|
||||
@@ -78,9 +78,6 @@ module.exports = class factorioServer {
|
||||
|
||||
// create files
|
||||
let files = [
|
||||
{name: "/script-output/output.txt", content: ""},
|
||||
{name: "/script-output/orders.txt", content: ""},
|
||||
{name: "/script-output/txbuffer.txt", content: ""},
|
||||
{name: "/config.ini", content: "[path]\r\n\ read-data=__PATH__executable__/../../data\r\n\ write-data=__PATH__executable__/../../../" + this.instanceDirectory + "\r\n\ "},
|
||||
{name: "/config.json", content: JSON.stringify({
|
||||
factorioPort: this.factorioPort,
|
||||
|
||||
@@ -10,6 +10,12 @@ const getLua = require("lib/clusterTools/getLua");
|
||||
const pluginConfig = require("./config");
|
||||
const COMPRESS_LUA = false;
|
||||
|
||||
function ensureFileSync(path) {
|
||||
if (!fs.existsSync(path)) {
|
||||
fs.outputFileSync(path, "");
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = class remoteCommands {
|
||||
constructor(mergedConfig, messageInterface, extras){
|
||||
this.messageInterface = messageInterface;
|
||||
@@ -27,6 +33,10 @@ module.exports = class remoteCommands {
|
||||
'x-access-token': this.config.masterAuthToken
|
||||
},
|
||||
};
|
||||
|
||||
ensureFileSync(instancedirectory + "/script-output/output.txt");
|
||||
ensureFileSync(instancedirectory + "/script-output/orders.txt");
|
||||
ensureFileSync(instancedirectory + "/script-output/txbuffer.txt");
|
||||
|
||||
(async ()=>{
|
||||
let hotpatchInstallStatus = await checkHotpatchInstallation(this.messageInterface);
|
||||
|
||||
Reference in new issue
Block a user