16#include <zypp-core/APIConfig.h>
65 pMIL(
"getConfigFiles for stem", configStem,
"below", root_r,
"in",
_etcDir,
_usrDir );
67 std::string configSuffix { configStem.
extension() };
70 std::vector<Pathname> lookupDirs;
79 std::map<std::string,PathInfo> dropinsToParse;
81 for (
const Pathname & ldir : lookupDirs ) {
83 PathInfo basecfg { ldir / configStem };
87 PathInfo dropinDir { ldir / configDir };
88 if ( dropinDir.
isDir() ) {
90 if ( entry.name[0] ==
'.' )
92 if ( not ( configSuffix.empty() || str::hasSuffix( entry.name, configSuffix ) ) )
94 PathInfo dropin { p / entry.name };
102 std::vector<Pathname> ret;
104 for (
const auto & [
_,p] : dropinsToParse ) {
109 pMIL(
"No config files found for stem", configStem,
"below", root_r );
118 lookupDirs_r.push_back( dir_r );
129 if (
isSet( toParse_r ) ) {
130 pDBG(
"masked", file_r,
"by", toParse_r );
132 toParse_r = std::move(file_r);
140 if (
isSet( file_r ) ) {
141 pMIL(
"take", file_r );
142 ret_r.push_back( file_r.
path() );
165 pDBG( stem_r,
"below", root_r,
":", *
this );
#define ZYPP_THROW(EXCPT)
Drops a logline and throws the Exception.
Wrapper class for stat/lstat.
const Pathname & path() const
Return current Pathname.
bool isExist() const
Return whether valid stat info exists.
Pathname extend(const std::string &r) const
Append string r to the last component of the path.
bool relativeDotDot() const
Test for a relative path referring to ../.
bool emptyOrRoot() const
Test for "" or "/".
bool empty() const
Test for an empty path.
Pathname absolutename() const
Return this path, adding a leading '/' if relative.
std::string extension() const
Return all of the characters in name after and including the last dot in the last element of name.
bool relative() const
Test for a relative path.
void read(const InputStream &is, const ProgressData::ReceiverFnc &progress=ProgressData::ReceiverFnc())
Fill a dictionary from a InputStream containing a ini structured file.
IniDict(const InputStream &is, const ProgressData::ReceiverFnc &progress=ProgressData::ReceiverFnc())
Creates a dictionary from a InputStream containing a ini structured file.
int dirForEachExt(const Pathname &dir_r, const function< bool(const Pathname &, const DirEntry &)> &fnc_r)
Simiar to.
std::string sprint(Args &&... args)
Print words as string.
Listentry returned by readdir.
static Pathname defaultDistconfDir()
Where the vendor configuration files live (APIConfig(LIBZYPP_ZYPPCONFDIR)).
Provide access to the prioritized list of files and drop-ins to read and merge for a specific config ...
static void takeOrMask(const PathInfo &file_r, PathInfo &toParse_r)
The 1st viable file_r is stored in toParse_r; candidates found later are masked.
std::vector< Pathname > getConfigFiles(const std::string &stem_r, const Pathname &root_r=Pathname("/")) const
static void handOutIf(std::vector< Pathname > &ret_r, const PathInfo &file_r)
Store set values in ret_r.
static void takeLookupDirIf(std::vector< Pathname > &lookupDirs_r, Pathname dir_r)
Remember valid lookup dirs.
std::optional< Pathname > _etcDir
system configuration: /etc
const std::optional< Pathname > & usrDir() const
static bool isSet(const PathInfo &file_r)
An empty path denotes the unset value.
ConfigurationContext(std::optional< Pathname > etcDir_r, std::optional< Pathname > usrDir_r)
static Pathname _defaultDistconfDir
APIConfig(LIBZYPP_ZYPPCONFDIR) but amendable for Testing.
const std::optional< Pathname > & etcDir() const
std::optional< Pathname > _usrDir
vendor configuration: distconfdir (APIConfig(LIBZYPP_ZYPPCONFDIR))