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

Method add_file

src/resource/data_compiler.cpp:643–670  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

641}
642
643void DataCompiler::add_file(const char *path)
644{
645 // Get source directory prefix
646 TempAllocator512 ta;
647 DynamicString source_dir(ta);
648 source_dir = hash_map::get(_source_dirs, source_dir, source_dir);
649
650 // Convert to DynamicString
651 DynamicString str(ta);
652 str.set(path, strlen32(path));
653
654 Stat deff_st;
655 deff_st.file_type = Stat::NO_ENTRY;
656 deff_st.size = 0;
657 deff_st.mtime = 0;
658 Stat prev_st = hash_map::get(_source_index._paths, str, deff_st);
659
660 // Get file status.
661 FilesystemDisk fs(default_allocator());
662 fs.set_prefix(source_dir.c_str());
663 Stat st;
664 st = fs.stat(path);
665 hash_map::set(_source_index._paths, str, st);
666
667 // Avoid sending spurious add_file() notifications for already known paths.
668 if (prev_st.file_type == Stat::NO_ENTRY)
669 notify_add_file(path, st);
670}
671
672void DataCompiler::remove_file(const char *path)
673{

Callers

nothing calls this directly

Calls 7

getFunction · 0.85
setClass · 0.85
notify_add_fileFunction · 0.85
set_prefixMethod · 0.80
setMethod · 0.45
c_strMethod · 0.45
statMethod · 0.45

Tested by

no test coverage detected