MCPcopy Create free account
hub / github.com/apache/trafficserver / load_file_glob

Method load_file_glob

plugins/experimental/txn_box/plugin/src/Config.cc:729–749  ·  view source on GitHub ↗

------------------------------------------------------------------------------------ */

Source from the content-addressed store, hash-verified

727}
728/* ------------------------------------------------------------------------------------ */
729Errata
730Config::load_file_glob(TextView pattern, swoc::TextView cfg_key, YamlCache *cache)
731{
732 int flags = 0;
733 glob_t files;
734 auto err_f = [](char const *, int) -> int { return 0; };
735 swoc::file::path abs_pattern = ts::make_absolute(pattern);
736 int result = glob(abs_pattern.c_str(), flags, err_f, &files);
737 if (result == GLOB_NOMATCH) {
738 return Errata(S_WARN, R"(The pattern "{}" did not match any files.)", abs_pattern);
739 }
740 for (size_t idx = 0; idx < files.gl_pathc; ++idx) {
741 auto errata = this->load_file(swoc::file::path(files.gl_pathv[idx]), cfg_key, cache);
742 if (!errata.is_ok()) {
743 errata.note(R"(While processing pattern "{}".)", pattern);
744 return errata;
745 }
746 }
747 globfree(&files);
748 return {};
749}
750/* ------------------------------------------------------------------------------------ */
751Errata
752Config::load_cli_args(Handle handle, const std::vector<std::string> &args, int arg_idx, YamlCache *cache)

Callers 1

load_cli_argsMethod · 0.95

Calls 7

load_fileMethod · 0.95
make_absoluteFunction · 0.85
ErrataClass · 0.85
pathClass · 0.85
c_strMethod · 0.45
is_okMethod · 0.45
noteMethod · 0.45

Tested by

no test coverage detected