| 238 | } |
| 239 | |
| 240 | bool 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 | |
| 272 | bool CScriptEngine::process_file(const char* file_name) { return process_file_if_exists(file_name, true); } |
no test coverage detected