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

Function check_parent_path

src/traffic_layout/engine.cc:76–94  ·  view source on GitHub ↗

the function for the checking of the yaml file in passed in directory or parent directory if found return the parent path containing the yaml file

Source from the content-addressed store, hash-verified

74// the function for the checking of the yaml file in passed in directory or parent directory
75// if found return the parent path containing the yaml file
76std::string
77check_parent_path(const std::string &path)
78{
79 std::string yaml_path = path;
80 if (yaml_path.back() == '/') {
81 yaml_path.pop_back();
82 }
83 // go up to 4 level of parent directories
84 for (int i = 0; i < 4; i++) {
85 if (yaml_path.empty()) {
86 return {};
87 }
88 if (exists(Layout::relative_to(yaml_path, "runroot.yaml"))) {
89 return yaml_path;
90 }
91 yaml_path = yaml_path.substr(0, yaml_path.find_last_of("/"));
92 }
93 return {};
94}
95
96// handle the path of the engine during parsing
97static std::string

Callers 2

path_handlerFunction · 0.85
create_runrootMethod · 0.85

Calls 4

pop_backMethod · 0.80
existsFunction · 0.50
emptyMethod · 0.45
substrMethod · 0.45

Tested by

no test coverage detected