mirror of https://github.com/OpenMW/openmw.git
Merge branch 'esm_ifstream' into 'master'
Use ifstream for ESMReader See merge request OpenMW/openmw!1776pull/3226/head
commit
b4503c9c0a
@ -0,0 +1,16 @@
|
||||
#include "openfile.hpp"
|
||||
|
||||
#include <cstring>
|
||||
#include <fstream>
|
||||
|
||||
namespace Files
|
||||
{
|
||||
std::unique_ptr<std::ifstream> openBinaryInputFileStream(const std::string& path)
|
||||
{
|
||||
auto stream = std::make_unique<std::ifstream>(path, std::ios::binary);
|
||||
if (!stream->is_open())
|
||||
throw std::runtime_error("Failed to open '" + path + "' for reading: " + std::strerror(errno));
|
||||
stream->exceptions(std::ios::badbit);
|
||||
return stream;
|
||||
}
|
||||
}
|
@ -0,0 +1,13 @@
|
||||
#ifndef OPENMW_COMPONENTS_FILES_OPENFILE_H
|
||||
#define OPENMW_COMPONENTS_FILES_OPENFILE_H
|
||||
|
||||
#include <iosfwd>
|
||||
#include <memory>
|
||||
#include <string>
|
||||
|
||||
namespace Files
|
||||
{
|
||||
std::unique_ptr<std::ifstream> openBinaryInputFileStream(const std::string& path);
|
||||
}
|
||||
|
||||
#endif
|
Loading…
Reference in New Issue