Skip to content

Commit 7a9643f

Browse files
committed
fix broken LAS reading
1 parent fa66ee6 commit 7a9643f

File tree

2 files changed

+11
-9
lines changed

2 files changed

+11
-9
lines changed

.DS_Store

0 Bytes
Binary file not shown.

src/main.cpp

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -548,17 +548,19 @@ int main(int argc, const char * argv[]) {
548548
}
549549
}
550550
else {
551-
if (!boost::filesystem::exists(thepath) || !boost::filesystem::is_directory(thepath)) {
552-
std::cerr << "ERROR: " << thepath << " is not a valid path. Can not read LAS file.\n";
551+
boost::filesystem::path p;
552+
try {
553+
p = canonical(thepath, ypcan).make_preferred();
554+
}
555+
catch (boost::filesystem::filesystem_error &e) {
556+
std::cerr << "WARNING: " << e.what() << ". Abort." << std::endl;
553557
return EXIT_FAILURE;
554-
} else {
555-
PointFile pointFile;
556-
boost::filesystem::path p = canonical(thepath, ypcan).make_preferred();
557-
pointFile.filename = p.string();
558-
pointFile.lasomits = lasomits;
559-
pointFile.thinning = thinning;
560-
elevationFiles.push_back(pointFile);
561558
}
559+
PointFile pointFile;
560+
pointFile.filename = p.string();
561+
pointFile.lasomits = lasomits;
562+
pointFile.thinning = thinning;
563+
elevationFiles.push_back(pointFile);
562564
}
563565
}
564566
}

0 commit comments

Comments
 (0)