| 207 | } |
| 208 | |
| 209 | static const ScriptFile* GetScriptFileRecursive(const ScriptFile* parent_script_file, const Path& path) { |
| 210 | // Look in script file cache for desired script file |
| 211 | ScriptFileMap& file_map = ScriptFileCache::Instance()->files; |
| 212 | ScriptFileMap::iterator iter; |
| 213 | iter = file_map.find(path.GetFullPathStr()); |
| 214 | ModID modsource; |
| 215 | if (iter == file_map.end()) { |
| 216 | // Desired script file not found, so load it |
| 217 | std::string source = ReadScriptFile(path); |
| 218 | if (!source.empty()) { |
| 219 | ScriptFile& file = file_map[path.GetFullPathStr()]; |
| 220 | UpdateFile(parent_script_file, file, source, path); |
| 221 | return &file; |
| 222 | } |
| 223 | } else { |
| 224 | // Script file found -- make sure it hasn't changed |
| 225 | ScriptFile& script_file = (*iter).second; |
| 226 | if (ScriptFileUtil::DetectScriptFileChanged(path)) { |
| 227 | std::string source = ReadScriptFile(path); |
| 228 | if (!source.empty()) { |
| 229 | UpdateFile(parent_script_file, script_file, source, path); |
| 230 | return &script_file; |
| 231 | } |
| 232 | } else { |
| 233 | return &script_file; |
| 234 | } |
| 235 | } |
| 236 | |
| 237 | return NULL; |
| 238 | } |
| 239 | |
| 240 | static void InsertFileRange(FileRangeList& ranges, |
| 241 | unsigned start, |
no test coverage detected