longturn / freeciv21

Develop your civilization from humble roots to a global empire
GNU General Public License v3.0
219 stars 42 forks source link

Unused Environment Variables #573

Open jwrober opened 3 years ago

jwrober commented 3 years ago

Is your feature request related to a problem? Please describe. The code has a ton of legacy support for environment variables that we don't really use/support any longer.

Describe the solution you'd like Move away from them and where needed add options in the RC/INI file(s) to support them.

Describe alternatives you've considered Convert them to command-line parameters. This might still be an option, but it seems more elegant to support in RC/INI file(s) with GUI options to set in the client

Additional context It seems this is a vestige of old-school classic freeciv operating in a day and age when environment variables were "en vogue". That is not really good way of working today.

lmoureaux commented 3 years ago

getenv():


client/options.cpp:  auto name = QString::fromLocal8Bit(qgetenv("FREECIV_OPT"));
client/options.cpp:  auto name = QString::fromLocal8Bit(qgetenv("FREECIV_OPT"));
common/capstr.cpp:#include <cstdlib> // getenv()
common/capstr.cpp:  s = getenv("FREECIV_CAPS");
common/networking/packets.cpp:    const char *s = getenv("FREECIV_COMPRESSION_LEVEL");
utility/fciconv.cpp:  data_encoding = getenv("FREECIV_DATA_ENCODING");
utility/fciconv.cpp:  local_encoding = getenv("FREECIV_LOCAL_ENCODING");
utility/fciconv.cpp:  internal_encoding = getenv("FREECIV_INTERNAL_ENCODING");
utility/shared.cpp:    char *env = getenv("USER");
utility/shared.cpp:  langname = getenv("LANG");
utility/shared.cpp:  char *lang = getenv("LANG");
utility/shared.cpp:    char *env = getenv("FREECIV_MULTICAST_GROUP");

Some more:

utility/shared.cpp:    data_dir_names = base_get_dirs("FREECIV_DATA_PATH");
utility/shared.cpp:    save_dir_names = base_get_dirs("FREECIV_SAVE_PATH");
utility/shared.cpp:    scenario_dir_names = base_get_dirs("FREECIV_SCENARIO_PATH");