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

Function create_directories

lib/swoc/src/swoc_file.cc:293–324  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

291}
292
293bool
294create_directories(const path &p, std::error_code &ec, mode_t mode) noexcept {
295 TextView text(p.string());
296
297 if (text.empty()) {
298 ec = std::error_code(EINVAL, std::system_category());
299 return false;
300 }
301
302 path path;
303
304 if (text.front() == path::SEPARATOR) {
305 path = text.prefix(1); // copy leading separator.
306 ++text;
307 if (!text) {
308 ec.clear();
309 return true; // Tried to create root directory, it's already tehre.
310 }
311 }
312
313 path.reserve(p.string().size());
314
315 while (text) {
316 auto elt = text.take_prefix_at(path::SEPARATOR);
317 path /= elt;
318 if (!create_directory(path, ec, mode)) {
319 return false;
320 }
321 }
322
323 return true;
324}
325
326bool
327copy(const path &from, const path &to, std::error_code &ec) {

Callers 11

test_swoc_file.ccFile · 0.85
persist_bad_disksFunction · 0.85
temp_prefixFunction · 0.85
temp_prefixFunction · 0.85
temp_prefixFunction · 0.85
getRemapPluginMethod · 0.85
setupSandBoxFunction · 0.85
setupConfigPathTestFunction · 0.85
test_PluginDso.ccFile · 0.85
try_loading_pluginFunction · 0.85

Calls 8

take_prefix_atMethod · 0.80
create_directoryFunction · 0.70
stringMethod · 0.45
emptyMethod · 0.45
prefixMethod · 0.45
clearMethod · 0.45
reserveMethod · 0.45
sizeMethod · 0.45

Tested by 3

temp_prefixFunction · 0.68
setupSandBoxFunction · 0.68
setupConfigPathTestFunction · 0.68