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

Add: '-X' option to ignore global folders in the search path #9341

Merged
merged 1 commit into from Jun 10, 2021

Conversation

@TrueBrain
Copy link
Member

@TrueBrain TrueBrain commented Jun 9, 2021

Motivation / Problem

Imagine this: you have 400 NewGRFs and 4 basesets in your ~/.local/share/openttd folder. You want to run some automated tests for OpenTTD that has 10 NewGRFs and 1 baseset. Owh no, it still looks all those other NewGRFs too!

But wait, we have -c you say! Yeah .. that doesn't work for the global folders.

Okay okay .. so I just rename that ~/.local/share/openttd folder every time .. well .. I am crazy, but not that crazy.

Description

So I present you with an alternative: -X. This setting completely ignores global folders and only use the ones you gave with -c. Nice.

This is extreme useful for automated testing. Without this, OpenTTD
will always look in your personal-dir (like ~/.local/share/openttd
or %USER%\Documents\OpenTTD). For most users this is exactly what
we want, that there is a shared place for all their files.

However, for automated testing this is rather annoying, as your
local development files influence the automated test. As such,
'-X' counters this, and only gives the local folders. This is
especially useful in combination with '-x' and '-c'.

Limitations

Checklist for review

Some things are not automated, and forgotten often. This list is a reminder for the reviewers.

  • The bug fix is important enough to be backported? (label: 'backport requested')
  • This PR affects the save game format? (label 'savegame upgrade')
  • This PR affects the GS/AI API? (label 'needs review: Script API')
    • ai_changelog.hpp, gs_changelog.hpp need updating.
    • The compatibility wrappers (compat_*.nut) need updating.
  • This PR affects the NewGRF API? (label 'needs review: NewGRF')
src/openttd.cpp Outdated Show resolved Hide resolved
@rubidium42
Copy link
Contributor

@rubidium42 rubidium42 commented Jun 10, 2021

Shouldn't docs/openttd.6 (the man page) be updated with this new parameter?

This is extreme useful for automated testing. Without this, OpenTTD
will always look in your personal-dir (like ~/.local/share/openttd
or %USER%\Documents\OpenTTD). For most users this is exactly what
we want, that there is a shared place for all their files.

However, for automated testing this is rather annoying, as your
local development files influence the automated test. As such,
'-X' counters this, and only gives the local folders. This is
especially useful in combination with '-x' and '-c'.
@TrueBrain TrueBrain force-pushed the TrueBrain:easier-savegame-testing branch from 26837bf to 357c617 Jun 10, 2021
@TrueBrain
Copy link
Member Author

@TrueBrain TrueBrain commented Jun 10, 2021

Shouldn't docs/openttd.6 (the man page) be updated with this new parameter?

lol, we have that file? Is that still in use ...

Either way, that file hasn't been updated in a while, and I have no clue how I would be to update it. Even worse, it uses different ways to describe the same settings than openttd.cpp .. so I think it should just be overhauled completely. But 0 clue how to do that, and I really do not feel like spending time on it :P (sorry, but at least I am honest :D)

@TrueBrain TrueBrain merged commit ed3946e into OpenTTD:master Jun 10, 2021
13 checks passed
13 checks passed
@github-actions
Emscripten
Details
@github-actions
Commit checker
Details
@github-actions
Check preview needs update Check preview needs update
Details
@github-actions
Linux (clang, clang++, libsdl2-dev)
Details
@github-actions
Linux (gcc, g++, libsdl2-dev)
Details
@github-actions
Linux (gcc, g++, libsdl1.2-dev)
Details
@github-actions
Linux (gcc, g++, -DOPTION_DEDICATED=ON)
Details
@github-actions
Mac OS (x64, x86_64)
Details
@github-actions
Windows (windows-latest, x86)
Details
@github-actions
Windows (windows-latest, x64)
Details
@github-actions
Windows (windows-2016, x86)
Details
@github-actions
Windows (windows-2016, x64)
Details
@github-actions
Check Annotations
Details
@TrueBrain TrueBrain deleted the TrueBrain:easier-savegame-testing branch Jun 10, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

None yet

3 participants