Revert "check in SRSLTE_CONFIG_DIR for configs by default"

This reverts commit fb77cb87ca.
This commit is contained in:
Ismael Gomez 2018-06-04 17:36:59 +02:00
parent 3631c4a83f
commit 863fe4fcd0
1 changed files with 7 additions and 6 deletions

View File

@ -35,15 +35,16 @@ bool config_exists(std::string &filename, std::string default_name)
{
std::ifstream conf(filename.c_str(), std::ios::in);
if(conf.fail()) {
const char *config_dir = NULL;
const char *homedir = NULL;
char full_path[256];
ZERO_OBJECT(full_path);
if ((config_dir = getenv("SRSLTE_CONFIG_DIR")) == NULL) {
fprintf(stderr, "No environment variable SRSLTE_CONFIG_DIR defined.\n"
"Please run \"export SRSLTE_CONFIG_DIR=/usr/etc/srs\" to define it.\n\n");
return false;
if ((homedir = getenv("HOME")) == NULL) {
homedir = getpwuid(getuid())->pw_dir;
}
snprintf(full_path, sizeof(full_path), "%s/%s", config_dir, default_name.c_str());
if (!homedir) {
homedir = ".";
}
snprintf(full_path, sizeof(full_path), "%s/.srs/%s", homedir, default_name.c_str());
filename = std::string(full_path);
// try to open again