MCPcopy Create free account
hub / github.com/crownengine/crown / remove_tree

Method remove_tree

src/resource/data_compiler.cpp:695–724  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

693}
694
695void DataCompiler::remove_tree(const char *path)
696{
697 TempAllocator512 ta;
698 DynamicString tree_path(ta);
699 tree_path = path;
700 tree_path += '/';
701
702 Vector<DynamicString> dangling_paths(default_allocator());
703
704 auto cur = hash_map::begin(_source_index._paths);
705 auto end = hash_map::end(_source_index._paths);
706 for (; cur != end; ++cur) {
707 HASH_MAP_SKIP_HOLE(_source_index._paths, cur);
708
709 // Skip if it is not a sub-path
710 if (!cur->first.has_prefix(tree_path.c_str()))
711 continue;
712
713 // Skip if is has been deleted previously
714 if (cur->second.file_type == Stat::NO_ENTRY)
715 continue;
716
717 vector::push_back(dangling_paths, cur->first);
718 }
719
720 for (u32 ii = 0; ii < vector::size(dangling_paths); ++ii)
721 remove_file(dangling_paths[ii].c_str());
722
723 notify_remove_tree(path);
724}
725
726void DataCompiler::remove_file_or_tree(const char *path)
727{

Callers

nothing calls this directly

Calls 5

notify_remove_treeFunction · 0.85
beginFunction · 0.50
endFunction · 0.50
sizeFunction · 0.50
c_strMethod · 0.45

Tested by

no test coverage detected