EmptyEpsilon icon indicating copy to clipboard operation
EmptyEpsilon copied to clipboard

comms_station.lua etc. from user directory are ignored

Open capt-t opened this issue 4 years ago • 4 comments

comms_station.lua from the game's scripts directory is still used even if the file is also in the user's scripts directory. (It works if it is only in the user's scripts directory.)

Similar to #1010.

capt-t avatar Aug 08 '20 08:08 capt-t

Can't reproduce on Linux. It works as intended when I create a file called ~/.emptyepsilon/scripts/comms_station.lua

czenker avatar Oct 10 '20 08:10 czenker

Ah. I think I found the problem, why it woks for me, but does not for you. EE seems to use resources from the current working directory. So, if you run the EmptyEpsilon binary from within the directory it lives in, it adds its own resources again with a higher priority than the file from your HOME directory:

https://github.com/daid/EmptyEpsilon/blob/3e36be59b9dc7de450a6e5049e7f905356b6fab1/src/main.cpp#L157-L159

The easy solution is to just start the binary from a different directory. :smile:

czenker avatar Oct 10 '20 08:10 czenker

Digging deeper revealed that it gets worse: The behavior is different depending on operating system.

https://github.com/daid/EmptyEpsilon/blob/3e36be59b9dc7de450a6e5049e7f905356b6fab1/src/main.cpp#L145-L172

RESOURCE_BASE_DIR is only configured on Linux during compile time. So this basically means, that EE will not run on Apple and Windows if you do not start the binary from within the base directory. Plus the HOME env variable is only available on Linux and Apple by default (unless of course a Windows User sets it)

So, the load order of all Lua files is

for Windows

  • if mod is selected: the mod directory inside the EE installation
  • the defaults from the EE installation

As far as I see there is no way that files from the home directory are loaded on windows. Is this right?

for Apple

  • if mod is selected: the mod directory in the home directory
  • if mod is selected: the mod directory inside the EE installation
  • the defaults from the EE installation
  • from the home directory

for Linux

  • if mod is selected: the mod directory in the home directory
  • if mod is selected: the mod directory inside the EE installation
  • from your current working directory (if this happens to be the RESOURCE_BASE_PATH this behaves as above)
  • from the home directory
  • the defaults from the EE installation

Conclusion

So this is confusing to say the least. The only portable way to do changes is to use the mod directory in the EE installation.

What do you think, @daid? For me this seems to be a source of constant confusion, but changing it will likely break someones setup.

czenker avatar Oct 10 '20 10:10 czenker

if mod is selected: the mod directory inside the EE installation

Worth noting that on macOS/OS X running EE from an app bundle, this is inside the app bundle itself, at EmptyEpsilon.app/Content/Resources/mods.

cf. PR #1056 on similar problems in game state logging.

oznogon avatar Oct 13 '20 20:10 oznogon