Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Missing Savefiles - please warn if started from ~/.config/openttd/ #8073

Closed
kramsfasel opened this issue Apr 10, 2020 · 4 comments
Closed

Missing Savefiles - please warn if started from ~/.config/openttd/ #8073

kramsfasel opened this issue Apr 10, 2020 · 4 comments

Comments

@kramsfasel
Copy link

Version of OpenTTD

OpenTTD 1.9.3 (Debian Linux)

Expected result

Show my savefiles

Actual result

expected savefiles not visible, due to selection of wrong path (~/.config/openttd/save instead of ~/.local/share/openttd/save)

Steps to reproduce

start openttd from your home, save game, quit openttd; goto config directory (cd ~/.config/openttd), start openttd from there, recent saved savefile gone. quit openttd; go back to home (cd ~) and start openttd from there, savefile visible again.

Haven't looked a the code, if this is on purpose or not, in any case it was a good scare. So please add a warning, at least on the shell, if started from an special place (looks like it only applies if starting from the configdirectory, every other location I tested didn't provoke this behavior).

@Eddi-z
Copy link
Contributor

Eddi-z commented Apr 10, 2020

you can check our directory structure here:

https://github.com/OpenTTD/OpenTTD/blob/master/docs/directory_structure.md

@kramsfasel
Copy link
Author

@ Eddi-z: Thanks. What should I've learnt there? The problem is not that it behaves differently for a reason (or without one). The problem is, that for a normal user it is not easy to see why it sudden behaves different and that it is somehow intended. Therefor a small hint "found savefiles in .config/save, but also found *.sav in ~/.local/share/openttd (likely due to respect of $XDG_DATA_HOME) - dismiss/remeber_dismissed" would be helpful. If you don't pay attention to the directory you're in when starting openttd -and who does all the time?- it appears as if your computer has lost the files. Scary experience.

@nielsmh
Copy link
Contributor

nielsmh commented Apr 10, 2020

Possibly related to the "portable app" behaviour: If openttd.cfg is found in the current directory during startup, portable mode is enabled and the search paths are different.

@TrueBrain
Copy link
Member

There have been several changes and fixes to how we look-up files and folders. I think this is mostly fixed (mainly due to #8357).

Note 1:
If you start OpenTTD from ~/.config/openttd while not having ~/.local/share/openttd/save already, it will create a save folder in ~/.config/openttd. This is as intended, as at that moment it considers the ~/.config/openttd to be a non-XDG folder. Basically, once you started OpenTTD from any other folder, things work as expected.

Note 2:
If for what-ever reason you create ~/.config/openttd/save, it will use ~/.config/openttd/save for your savegames when starting from ~/.config/openttd. This is because "working-directory" always wins from any other search-path. But a search-path never finds folders that don't exist.

Both notes are unlikely to ever happen in normal usage. So as long as you started the game once normally, you can now safely start it from ~/.config/openttd without it going all weird on you :)

If this isn't fixed for you, feel free to reopen :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants