Bisa / factorio-init

Factorio init script
MIT License
414 stars 82 forks source link

[BUG] Can't launch the server because it points to a wrong directory. #157

Closed Oscar-Rod closed 4 years ago

Oscar-Rod commented 4 years ago

The script fails to start the server.

To reproduce the issue just try to start any server. It will fail because on this line because the WRITE_DIR points to a wrong directory. I tried this in ubuntu 18.

To solve the issue I modified the line to:

WRITE_DIR="/opt/factorio"

Xiretza commented 4 years ago

What's the contents of your $FCONF, specifically write-data=?

Oscar-Rod commented 4 years ago

Actually, if I just execute service factorio new-game test1 it works.

However, if I execute service factorio new-game test1 map-gen-settings.json map-settings.json it doesn't. The error message I get is Specified map gen settings json does not exist.

But the file /opt/factorio/data/map-gen-settings.json exists.

WRITE_DIR takes the value /opt/factorio/bin/x64/../.. write-data in $FCONF has the value __PATH__executable__/../..

Xiretza commented 4 years ago

As you can see here, the script tries to read the files you pass relative to your $WRITE_DIR. Specifying map-gen-settings.json would in your case result in /opt/factorio/map-gen-settings.json. If you want it to use a file in a subdirectory, specify it:

service factorio new-game test1 data/map-gen-settings.json data/map-settings.json

(Note: haven't tested this myself, but it should work this way.)

Oscar-Rod commented 4 years ago

You are right, this solves it. Thank you!