| 24 | #include "../safeguards.h" |
| 25 | |
| 26 | bool ScriptScanner::AddFile(const std::string &filename, size_t, const std::string &tar_filename) |
| 27 | { |
| 28 | this->main_script = filename; |
| 29 | this->tar_file = tar_filename; |
| 30 | |
| 31 | auto p = this->main_script.find_last_of(PATHSEPCHAR); |
| 32 | this->main_script.erase(p != std::string::npos ? p + 1 : 0); |
| 33 | this->main_script += "main.nut"; |
| 34 | |
| 35 | if (!FioCheckFileExists(filename, this->subdir) || !FioCheckFileExists(this->main_script, this->subdir)) return false; |
| 36 | |
| 37 | this->ResetEngine(); |
| 38 | try { |
| 39 | this->engine->LoadScript(filename); |
| 40 | } catch (Script_FatalError &e) { |
| 41 | Debug(script, 0, "Fatal error '{}' when trying to load the script '{}'.", e.GetErrorMessage(), filename); |
| 42 | return false; |
| 43 | } |
| 44 | return true; |
| 45 | } |
| 46 | |
| 47 | ScriptScanner::ScriptScanner() = default; |
| 48 |
no test coverage detected