[Liblas-commits] libpc: catch missing file

liblas-commits at liblas.org liblas-commits at liblas.org
Wed Feb 23 14:45:27 EST 2011


details:   http://hg.liblas.orglibpc/rev/2c000ed3546b
changeset: 77:2c000ed3546b
user:      Michael P. Gerlek <mpg at flaxen.com>
date:      Wed Feb 23 11:44:40 2011 -0800
description:
catch missing file
Subject: libpc: init properly

details:   http://hg.liblas.orglibpc/rev/a3591d60a9f3
changeset: 78:a3591d60a9f3
user:      Michael P. Gerlek <mpg at flaxen.com>
date:      Wed Feb 23 11:44:54 2011 -0800
description:
init properly

diffstat:

 src/LasHeader.cpp |  1 +
 src/Utils.cpp     |  4 ++++
 2 files changed, 5 insertions(+), 0 deletions(-)

diffs (32 lines):

diff -r 709b9b078368 -r a3591d60a9f3 src/LasHeader.cpp
--- a/src/LasHeader.cpp	Wed Feb 23 11:32:05 2011 -0800
+++ b/src/LasHeader.cpp	Wed Feb 23 11:44:54 2011 -0800
@@ -55,6 +55,7 @@
 
 LasHeader::LasHeader()
     : Header()
+    , m_scales(0.0,0.0,0.0)
 {
     // BUG: set default here -- m_schema(LasSchema::ePointFormat3)
     initialize();
diff -r 709b9b078368 -r a3591d60a9f3 src/Utils.cpp
--- a/src/Utils.cpp	Wed Feb 23 11:32:05 2011 -0800
+++ b/src/Utils.cpp	Wed Feb 23 11:44:54 2011 -0800
@@ -39,6 +39,7 @@
 #include <boost/iostreams/stream.hpp>
 #include <boost/filesystem.hpp>
 
+#include "libpc/exceptions.hpp"
 #include "libpc/Utils.hpp"
 
 
@@ -68,6 +69,9 @@
 
 std::istream* Utils::openFile(std::string const& filename, bool asBinary)
 {
+    if (!Utils::fileExists(filename))
+        throw libpc_error("File not found: " + filename);
+
     std::ios::openmode mode = mode=std::ios::out;
     if (asBinary)
       mode |= mode=std::ios::binary;


More information about the Liblas-commits mailing list