diff options
Diffstat (limited to 'init/import_parser.cpp')
-rw-r--r-- | init/import_parser.cpp | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/init/import_parser.cpp b/init/import_parser.cpp index f66b2bae6..99275e5e7 100644 --- a/init/import_parser.cpp +++ b/init/import_parser.cpp @@ -20,7 +20,7 @@ #include "util.h" -bool ImportParser::ParseSection(const std::vector<std::string>& args, const std::string& filename, +bool ImportParser::ParseSection(std::vector<std::string>&& args, const std::string& filename, int line, std::string* err) { if (args.size() != 2) { *err = "single argument needed for import\n"; @@ -35,16 +35,18 @@ bool ImportParser::ParseSection(const std::vector<std::string>& args, const std: } LOG(INFO) << "Added '" << conf_file << "' to import list"; - imports_.emplace_back(std::move(conf_file)); + if (filename_.empty()) filename_ = filename; + imports_.emplace_back(std::move(conf_file), line); return true; } -void ImportParser::EndFile(const std::string& filename) { +void ImportParser::EndFile() { auto current_imports = std::move(imports_); imports_.clear(); - for (const auto& s : current_imports) { - if (!Parser::GetInstance().ParseConfig(s)) { - PLOG(ERROR) << "could not import file '" << s << "' from '" << filename << "'"; + for (const auto& [import, line_num] : current_imports) { + if (!parser_->ParseConfig(import)) { + PLOG(ERROR) << filename_ << ": " << line_num << ": Could not import file '" << import + << "'"; } } } |