Exemplo n.º 1
0
std::ifstream* Open(const std::string &file, bool) {
    LOG_D("agi/io/open/file") << file;
	acs::CheckFileRead(file);

	std::ifstream *stream = new std::ifstream(file.c_str());

	if (stream->fail())
		throw IOFatal("Unknown fatal error as occurred");

	return stream;
}
Exemplo n.º 2
0
std::unique_ptr<std::istream> Open(fs::path const& file, bool binary) {
	LOG_D("agi/io/open/file") << file;
	acs::CheckFileRead(file);

	auto stream = agi::make_unique<boost::filesystem::ifstream>(file, (binary ? std::ios::binary : std::ios::in));

	if (stream->fail())
		throw IOFatal("Unknown fatal error as occurred");

	return std::unique_ptr<std::istream>(stream.release());
}