From 6464d9913467c9667929de203c8d4b5bdc37f701 Mon Sep 17 00:00:00 2001 From: elsid Date: Mon, 6 Jan 2025 23:05:58 +0100 Subject: [PATCH] Throw system error on open file failure --- components/detournavigator/debug.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/components/detournavigator/debug.cpp b/components/detournavigator/debug.cpp index 5ce1464bdd..3a3430c9d3 100644 --- a/components/detournavigator/debug.cpp +++ b/components/detournavigator/debug.cpp @@ -1,5 +1,4 @@ #include "debug.hpp" -#include "exceptions.hpp" #include "recastmesh.hpp" #include "settings.hpp" #include "settingsutils.hpp" @@ -17,7 +16,7 @@ #include #include #include -#include +#include namespace DetourNavigator { @@ -224,7 +223,8 @@ namespace DetourNavigator const auto path = pathPrefix + "recastmesh" + revision + ".obj"; std::ofstream file(std::filesystem::path(path), std::ios::out); 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.precision(std::numeric_limits::max_exponent10); std::vector vertices = recastMesh.getMesh().getVertices(); @@ -271,7 +271,7 @@ namespace DetourNavigator const auto path = pathPrefix + "all_tiles_navmesh" + revision + ".bin"; std::ofstream file(std::filesystem::path(path), std::ios::out | std::ios::binary); 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); NavMeshSetHeader header;