Make similar changes to the previous commit for _xml_id.
[libdcp.git] / tools / dcpthumb.cc
index 73f70f2da007b001d02e33d49570d7126d8140ff..3ea32f92946f255de7f514079a9feb2f27ece987 100644 (file)
@@ -35,7 +35,6 @@
 #include "decrypted_kdm.h"
 #include "util.h"
 #include "exceptions.h"
-#include <boost/foreach.hpp>
 #include <getopt.h>
 
 using std::string;
@@ -53,6 +52,8 @@ help (string n)
 int
 main (int argc, char* argv[])
 {
+       dcp::init ();
+
        int option_index = 0;
        while (true) {
                struct option long_options[] = {
@@ -78,6 +79,12 @@ main (int argc, char* argv[])
                exit (EXIT_FAILURE);
        }
 
-       cout << dcp::Certificate(dcp::file_to_string(argv[optind])).thumbprint() << "\n";
+       try {
+               cout << dcp::Certificate(dcp::file_to_string(argv[optind])).thumbprint() << "\n";
+       } catch (boost::filesystem::filesystem_error& e) {
+               cerr << e.what() << "\n";
+               return -1;
+       }
+
        return 0;
 }