aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorvimene <vincent.menegaux@gmail.com>2025-12-13 16:07:53 +0100
committervimene <vincent.menegaux@gmail.com>2025-12-13 16:07:53 +0100
commit98b9f7a1a7eeaa3b6495a1bb3b88309aee7f49de (patch)
tree241ab1e1e2bc924bc09b338b4d0601de85ab035d
parent761604f9e4815e8f4355637ebb46052314cbed86 (diff)
downloadengine-98b9f7a1a7eeaa3b6495a1bb3b88309aee7f49de.tar.gz
check if file exists in obj_parser.cpp
-rw-r--r--src/obj_parser.cpp4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/obj_parser.cpp b/src/obj_parser.cpp
index 196261e..b30eff1 100644
--- a/src/obj_parser.cpp
+++ b/src/obj_parser.cpp
@@ -92,6 +92,10 @@ float parse_int(const std::string& s) {
o3d::Mesh parse_object(const std::string& obj_path) {
o3d::Mesh mesh;
std::ifstream obj_file(obj_path);
+ if (!obj_file.is_open()) {
+ std::cerr << "file `" << obj_path << "'not found" << std::endl; // TODO: improve
+ std::exit(1);
+ }
std::string line;
while (std::getline(obj_file, line)) {
if (line.length() == 0 || line[0] == '#')