ihhub / fheroes2

fheroes2 is a recreation of Heroes of Might and Magic II game engine.
https://ihhub.github.io/fheroes2/
GNU General Public License v2.0
2.6k stars 365 forks source link

[Linux] from 0.9.2 fheroes2.cfg is written to $HOME directory #3118

Closed senneschall closed 3 years ago

senneschall commented 3 years ago

IIRC it was in $HOME/.local/share/fheroes2 before, which would be a better folder to write the config/savegame/map files to

The problem is, it reads the fheroes.cfg from the game base folder, but saves it to $HOME and never reads from there again. So any change that is made ingame is lost when you restart fheroes2.

Branikolog commented 3 years ago

Hello, @senneschall ! Are you sure about this? I mean all preferences made in game, like speed, sound level etc. are not lost on application restart...

undef21 commented 3 years ago

It's not Linux-only issue. You extract game to $HOME/fheroes2 for example. Then you change directory to $HOME and run game with command ./fheroes2/fheroes. After that game saves config to current work dir but try read config by relative path from game dir. Similarly on windows, if you extract game to c:\fh, cd to c:\fh2, then run ..\fh\fheroes2.exe, you get same issue. As workaround you should run game from game directory now.

senneschall commented 3 years ago

I was actually running the game from the ubuntu start menu. The .desktop file ran the binary directly with a /home/<user>/Games/HoMM2/fheroes2.

Adding a Path=/home/<user>/Games/HoMM2 did indeed resolve the issue, now the cfg from the game file is used and the one in $PATH can be deleted.

Most applications use one of the XDG DIRs on unix systems. Or use the folder where the binary lies instead of using the invoking path. Maybe that's an option for you?

undef21 commented 3 years ago

There is issue #2860 for XDG compiliance. Someday it will be implemented.