mirror of
https://gitlab.com/OpenMW/openmw.git
synced 2025-04-28 21:07:59 +03:00
Throw system error on open file failure
This commit is contained in:
parent
be1ce81be7
commit
6464d99134
1 changed files with 4 additions and 4 deletions
|
@ -1,5 +1,4 @@
|
||||||
#include "debug.hpp"
|
#include "debug.hpp"
|
||||||
#include "exceptions.hpp"
|
|
||||||
#include "recastmesh.hpp"
|
#include "recastmesh.hpp"
|
||||||
#include "settings.hpp"
|
#include "settings.hpp"
|
||||||
#include "settingsutils.hpp"
|
#include "settingsutils.hpp"
|
||||||
|
@ -17,7 +16,7 @@
|
||||||
#include <filesystem>
|
#include <filesystem>
|
||||||
#include <fstream>
|
#include <fstream>
|
||||||
#include <ostream>
|
#include <ostream>
|
||||||
#include <string_view>
|
#include <system_error>
|
||||||
|
|
||||||
namespace DetourNavigator
|
namespace DetourNavigator
|
||||||
{
|
{
|
||||||
|
@ -224,7 +223,8 @@ namespace DetourNavigator
|
||||||
const auto path = pathPrefix + "recastmesh" + revision + ".obj";
|
const auto path = pathPrefix + "recastmesh" + revision + ".obj";
|
||||||
std::ofstream file(std::filesystem::path(path), std::ios::out);
|
std::ofstream file(std::filesystem::path(path), std::ios::out);
|
||||||
if (!file.is_open())
|
if (!file.is_open())
|
||||||
throw NavigatorException("Open file failed: " + path);
|
throw std::system_error(
|
||||||
|
errno, std::generic_category(), "Failed to open file to write recast mesh: " + path);
|
||||||
file.exceptions(std::ios::failbit | std::ios::badbit);
|
file.exceptions(std::ios::failbit | std::ios::badbit);
|
||||||
file.precision(std::numeric_limits<float>::max_exponent10);
|
file.precision(std::numeric_limits<float>::max_exponent10);
|
||||||
std::vector<float> vertices = recastMesh.getMesh().getVertices();
|
std::vector<float> vertices = recastMesh.getMesh().getVertices();
|
||||||
|
@ -271,7 +271,7 @@ namespace DetourNavigator
|
||||||
const auto path = pathPrefix + "all_tiles_navmesh" + revision + ".bin";
|
const auto path = pathPrefix + "all_tiles_navmesh" + revision + ".bin";
|
||||||
std::ofstream file(std::filesystem::path(path), std::ios::out | std::ios::binary);
|
std::ofstream file(std::filesystem::path(path), std::ios::out | std::ios::binary);
|
||||||
if (!file.is_open())
|
if (!file.is_open())
|
||||||
throw NavigatorException("Open file failed: " + path);
|
throw std::system_error(errno, std::generic_category(), "Failed to open file to write navmesh: " + path);
|
||||||
file.exceptions(std::ios::failbit | std::ios::badbit);
|
file.exceptions(std::ios::failbit | std::ios::badbit);
|
||||||
|
|
||||||
NavMeshSetHeader header;
|
NavMeshSetHeader header;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue