* Compiles a file. * * @param path The path. * @returns Configuration items. */
| 258 | * @returns Configuration items. |
| 259 | */ |
| 260 | std::unique_ptr<Expression> ConfigCompiler::CompileFile(const String& path, const String& zone, |
| 261 | const String& package) |
| 262 | { |
| 263 | CONTEXT("Compiling configuration file '" << path << "'"); |
| 264 | |
| 265 | std::ifstream stream(path.CStr(), std::ifstream::in); |
| 266 | |
| 267 | if (!stream) |
| 268 | BOOST_THROW_EXCEPTION(posix_error() |
| 269 | << boost::errinfo_api_function("std::ifstream::open") |
| 270 | << boost::errinfo_errno(errno) |
| 271 | << boost::errinfo_file_name(path)); |
| 272 | |
| 273 | Log(LogNotice, "ConfigCompiler") |
| 274 | << "Compiling config file: " << path; |
| 275 | |
| 276 | return CompileStream(path, &stream, zone, package); |
| 277 | } |
| 278 | |
| 279 | /** |
| 280 | * Compiles a snippet of text. |
nothing calls this directly
no test coverage detected