MCPcopy Create free account
hub / github.com/WolfireGames/overgrowth / UpdateFile

Function UpdateFile

Source/Scripting/scriptfile.cpp:190–207  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

188}
189
190static void UpdateFile(const ScriptFile* parent_script_file, ScriptFile& file, const std::string& source, const Path& path) {
191 file.parent = parent_script_file;
192 file.unexpanded_contents = source;
193 file.contents = source;
194 file.file_path = path;
195 file.dependencies.clear();
196 file.dependencies.resize(1);
197 file.dependencies[0].path = path;
198 file.dependencies[0].modified = GetDateModifiedInt64(path);
199 file.ExpandIncludePaths();
200 file.hash = djb2_string_hash(file.contents.c_str());
201 std::vector<Dependency>::iterator iter = file.dependencies.begin();
202 file.latest_modification = (*iter).modified;
203 ++iter;
204 for (; iter != file.dependencies.end(); ++iter) {
205 file.latest_modification = max(file.latest_modification, (*iter).modified);
206 }
207}
208
209static const ScriptFile* GetScriptFileRecursive(const ScriptFile* parent_script_file, const Path& path) {
210 // Look in script file cache for desired script file

Callers 1

GetScriptFileRecursiveFunction · 0.85

Calls 9

GetDateModifiedInt64Function · 0.85
djb2_string_hashFunction · 0.85
maxFunction · 0.85
ExpandIncludePathsMethod · 0.80
clearMethod · 0.45
resizeMethod · 0.45
c_strMethod · 0.45
beginMethod · 0.45
endMethod · 0.45

Tested by

no test coverage detected