Skip to content

Commit

Permalink
Use config.yaml file from default cache location, if it exists (#410)
Browse files Browse the repository at this point in the history
* Use config.yaml file from default cache location, if it exists

Signed-off-by: Nate Koenig <[email protected]>

* support config.yml

Signed-off-by: Nate Koenig <[email protected]>

---------

Signed-off-by: Nate Koenig <[email protected]>
  • Loading branch information
nkoenig authored Apr 9, 2024
1 parent 1896341 commit 6cbce88
Showing 1 changed file with 14 additions and 8 deletions.
22 changes: 14 additions & 8 deletions src/ClientConfig.cc
Original file line number Diff line number Diff line change
Expand Up @@ -218,18 +218,24 @@ ClientConfig::ClientConfig() : dataPtr(new ClientConfigPrivate)
<< "to set cache path. Please use [GZ_FUEL_CACHE_PATH] instead."
<< std::endl;
}
else
{
return;
}
}

if (!gz::common::isDirectory(gzFuelPath))
if (!gzFuelPath.empty())
{
gzerr << "[" << gzFuelPath << "] is not a directory" << std::endl;
return;
if (!gz::common::isDirectory(gzFuelPath))
gzerr << "[" << gzFuelPath << "] is not a directory" << std::endl;
else
this->SetCacheLocation(gzFuelPath);
}
this->SetCacheLocation(gzFuelPath);

std::string configYamlFile = common::joinPaths(this->CacheLocation(),
"config.yaml");
std::string configYmlFile = common::joinPaths(this->CacheLocation(),
"config.yml");
if (gz::common::exists(configYamlFile))
this->LoadConfig(configYamlFile);
else if (gz::common::exists(configYmlFile))
this->LoadConfig(configYmlFile);
}

//////////////////////////////////////////////////
Expand Down

0 comments on commit 6cbce88

Please sign in to comment.