mirror of
				https://github.com/OpenMW/openmw.git
				synced 2025-11-04 14:26:42 +00:00 
			
		
		
		
	
		
			
				
	
	
		
			18 lines
		
	
	
	
		
			551 B
		
	
	
	
		
			C++
		
	
	
	
	
	
			
		
		
	
	
			18 lines
		
	
	
	
		
			551 B
		
	
	
	
		
			C++
		
	
	
	
	
	
#include "openfile.hpp"
 | 
						|
#include "conversion.hpp"
 | 
						|
 | 
						|
#include <cstring>
 | 
						|
#include <fstream>
 | 
						|
 | 
						|
namespace Files
 | 
						|
{
 | 
						|
    std::unique_ptr<std::ifstream> openBinaryInputFileStream(const std::filesystem::path& path)
 | 
						|
    {
 | 
						|
        auto stream = std::make_unique<std::ifstream>(path, std::ios::binary);
 | 
						|
        if (!stream->is_open())
 | 
						|
            throw std::runtime_error(
 | 
						|
                "Failed to open '" + Files::pathToUnicodeString(path) + "' for reading: " + std::strerror(errno));
 | 
						|
        stream->exceptions(std::ios::badbit);
 | 
						|
        return stream;
 | 
						|
    }
 | 
						|
}
 |