mirror of
https://github.com/clusterio/clusterio.git
synced 2026-11-19 23:33:13 +09:00
MacOS compatibility
This commit is contained in:
1 parent
641d8e9fc5
commit
b78eafaedb
2 files changed
+41
-3
No files matched your search
@@ -832,7 +832,7 @@ class FactorioServer extends events.EventEmitter {
|
||||
|
||||
await this._writeConfigIni();
|
||||
this._server = child_process.spawn(
|
||||
this.dataPath("..", "bin", "x64", "factorio"),
|
||||
this.getBinaryPath(),
|
||||
[
|
||||
"--config", this.writePath("config.ini"),
|
||||
"--create", this.writePath("saves", name),
|
||||
@@ -857,6 +857,20 @@ class FactorioServer extends events.EventEmitter {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Get Factorio binary path
|
||||
*
|
||||
* Get the path to the factorio binary depending on the platform (MacOS support)
|
||||
*
|
||||
* @return {string} path to factorio binary
|
||||
*/
|
||||
getBinaryPath() {
|
||||
if (process.platform === "darwin") {
|
||||
return this.dataPath("..", "MacOS", "factorio");
|
||||
}
|
||||
return this.dataPath("..", "bin", "x64", "factorio");
|
||||
}
|
||||
|
||||
/**
|
||||
* Start server
|
||||
*
|
||||
@@ -871,7 +885,7 @@ class FactorioServer extends events.EventEmitter {
|
||||
|
||||
await this._writeConfigIni();
|
||||
this._server = child_process.spawn(
|
||||
this.dataPath("..", "bin", "x64", "factorio"),
|
||||
this.getBinaryPath(),
|
||||
[
|
||||
"--config", this.writePath("config.ini"),
|
||||
"--start-server", this.writePath("saves", save),
|
||||
@@ -906,7 +920,7 @@ class FactorioServer extends events.EventEmitter {
|
||||
|
||||
await this._writeConfigIni();
|
||||
this._server = child_process.spawn(
|
||||
this.dataPath("..", "bin", "x64", "factorio"),
|
||||
this.getBinaryPath(),
|
||||
[
|
||||
"--config", this.writePath("config.ini"),
|
||||
"--start-server-load-scenario", scenario,
|
||||
|
||||
Reference in new issue
Block a user