MCPcopy Create free account
hub / github.com/OGSR/OGSR-Engine / process_file_if_exists

Method process_file_if_exists

ogsr_engine/COMMON_AI/script_engine.cpp:240–269  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

238}
239
240bool CScriptEngine::process_file_if_exists(const char* file_name, bool warn_if_not_exist) // KRodin: Функция проверяет существует ли скрипт на диске. Если существует - отправляет
241 // его в do_file. Вызывается из process_file, auto_load и не только.
242{
243 if (!warn_if_not_exist && no_file_exists(file_name)) //Это для оптимизации, чтоб постоянно не проверять, отсутствует ли этот файл.
244 return false;
245 if (m_reload_modules || (*file_name && !namespace_loaded(file_name)))
246 {
247 string_path S;
248 if (!LookupScript(S, file_name))
249 {
250 if (warn_if_not_exist)
251 MsgDbg("[CScriptEngine::process_file_if_exists] Variable %s not found; No script by this name exists, either.", file_name);
252 else
253 {
254 LogDbg("-------------------------");
255 MsgDbg("[CScriptEngine::process_file_if_exists] WARNING: Access to nonexistent variable or loading nonexistent script '%s'", file_name);
256 FuncDbg(print_stack());
257 LogDbg("-------------------------");
258 add_no_file(file_name);
259 }
260 return false;
261 }
262#ifdef DEBUG
263 MsgDbg("[CScriptEngine::process_file_if_exists] loading script: [%s]", file_name);
264#endif
265 m_reload_modules = false;
266 return do_file(S, file_name);
267 }
268 return true;
269}
270
271
272bool CScriptEngine::process_file(const char* file_name) { return process_file_if_exists(file_name, true); }

Callers 1

auto_loadFunction · 0.80

Calls 4

no_file_existsFunction · 0.85
add_no_fileFunction · 0.85
namespace_loadedFunction · 0.50
do_fileFunction · 0.50

Tested by

no test coverage detected