Skip to content

Commit 7a5e091

Browse files
author
Louis Fréneau
committed
Improve error handling if input point cloud path does not exist
1 parent 41ccaa3 commit 7a5e091

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

src/app/uvgVPCCencAppExample.cpp

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@
5252
#include <thread>
5353
#include <utility>
5454
#include <vector>
55+
#include <filesystem>
5556

5657
#include "../utils/utils.hpp"
5758
#include "cli.hpp"
@@ -102,9 +103,15 @@ void loadFrameFromPlyFile(const std::shared_ptr<uvgvpcc_enc::Frame>& frame, cons
102103
// uvgVPCCenc currently support only geometry of type unsigned int
103104
uvgvpcc_enc::Logger::log<uvgvpcc_enc::LogLevel::TRACE>(
104105
"APPLICATION", "Loading frame " + std::to_string(frame->frameId) + " from " + frame->pointCloudPath + "\n");
106+
107+
if(!std::filesystem::is_regular_file(frame->pointCloudPath)) {
108+
throw std::runtime_error("\nThis path does not exist: " + frame->pointCloudPath);
109+
}
110+
111+
105112
miniply::PLYReader reader(frame->pointCloudPath.c_str());
106113
if (!reader.valid()) {
107-
throw std::runtime_error("miniply : Failed to open " + frame->pointCloudPath);
114+
throw std::runtime_error("\nThe miniply reader failed to open " + frame->pointCloudPath);
108115
}
109116

110117
// In a PLY file, an 'element' is a section of the file (it can be 'vertex' which list all the vertices, 'face' when dealing with

0 commit comments

Comments
 (0)