[config] Add MANGOHUD_CONFIGFILE envvar for specific configuration file

Issue #104
pull/109/head
jackun 4 years ago
parent f8cc3bbf06
commit f5e3f3b73b
No known key found for this signature in database
GPG Key ID: 119DB3F1D05A9ED3

@ -96,10 +96,12 @@ You can find an example config in /usr/share/doc/mangohud
---
### `MANGOHUD_CONFIG` environment variable
### `MANGOHUD_CONFIG` and `MANGOHUD_CONFIGFILE` environment variables
You can also customize the hud by using the `MANGOHUD_CONFIG` environment variable while separating different options with a comma. This takes priority over any config file.
You can also specify configuration file with `MANGOHUD_CONFIGFILE=/path/to/config` for applications whose names are hard to guess (java, python etc).
A partial list of parameters are below. See the config file for a complete list.
| Variable | Description |

@ -26,9 +26,8 @@ void parseConfigLine(std::string line, std::unordered_map<std::string,std::strin
options[param] = value;
}
void parseConfigFile(overlay_params& params) {
params.options.clear();
std::vector<std::string> paths;
void enumerate_config_files(std::vector<std::string>& paths)
{
static const char *mangohud_dir = "/MangoHud/";
std::string env_data = get_data_dir();
@ -56,6 +55,17 @@ void parseConfigFile(overlay_params& params) {
}
}
}
}
void parseConfigFile(overlay_params& params) {
params.options.clear();
std::vector<std::string> paths;
const char *cfg_file = getenv("MANGOHUD_CONFIGFILE");
if (cfg_file)
paths.push_back(cfg_file);
else
enumerate_config_files(paths);
std::string line;
for (auto p = paths.rbegin(); p != paths.rend(); p++) {

Loading…
Cancel
Save