mirror of
https://github.com/clusterio/clusterio.git
synced 2026-11-21 08:03:13 +09:00
Make FactorioServer.exampleSettings static
Convert the exampleSettings method to be a static method.
This commit is contained in:
1 parent
039b41d3e6
commit
a3eb39712c
3 files changed
+5
-4
No files matched your search
@@ -75,7 +75,7 @@ class Instance {
|
|||||||
// save instance config
|
// save instance config
|
||||||
await fs.outputFile(instance.path("config.json"), JSON.stringify(instanceConfig, null, 4));
|
await fs.outputFile(instance.path("config.json"), JSON.stringify(instanceConfig, null, 4));
|
||||||
|
|
||||||
let serverSettings = await instance.server.exampleSettings();
|
let serverSettings = await factorio.FactorioServer.exampleSettings(path.join(factorioDir, "data"));
|
||||||
let gameName = "Clusterio instance: " + instance.name;
|
let gameName = "Clusterio instance: " + instance.name;
|
||||||
if (options.username) {
|
if (options.username) {
|
||||||
gameName = options.username + "'s clusterio " + instance.name;
|
gameName = options.username + "'s clusterio " + instance.name;
|
||||||
|
|||||||
@@ -753,10 +753,11 @@ class FactorioServer extends events.EventEmitter {
|
|||||||
*
|
*
|
||||||
* Loads server-settings.example.json from the data dir.
|
* Loads server-settings.example.json from the data dir.
|
||||||
*
|
*
|
||||||
|
* @param {string} dataDir - The data directory for Factorio
|
||||||
* @returns {object} the parsed server-settings.
|
* @returns {object} the parsed server-settings.
|
||||||
*/
|
*/
|
||||||
async exampleSettings() {
|
static async exampleSettings(dataDir) {
|
||||||
return JSON.parse(await fs.readFile(this.dataPath("server-settings.example.json"), "utf-8"));
|
return JSON.parse(await fs.readFile(path.join(dataDir, "server-settings.example.json"), "utf-8"));
|
||||||
}
|
}
|
||||||
|
|
||||||
async _writeConfigIni() {
|
async _writeConfigIni() {
|
||||||
|
|||||||
@@ -45,7 +45,7 @@ describe("Integration of lib/factorio/server", function() {
|
|||||||
describe(".exampleSettings()", function() {
|
describe(".exampleSettings()", function() {
|
||||||
let settings;
|
let settings;
|
||||||
it("returns an object", async function() {
|
it("returns an object", async function() {
|
||||||
settings = await server.exampleSettings();
|
settings = await factorio.FactorioServer.exampleSettings(path.join("factorio", "data"));
|
||||||
assert(typeof settings === "object");
|
assert(typeof settings === "object");
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
Reference in new issue
Block a user