Mercurial > dedupe
view Apps/updateDeDupe.cpp @ 113:27e628852401
Add some error checking.
| author | Tom Fredrik Blenning Klaussen <bfg@bfgconsult.no> |
|---|---|
| date | Tue, 03 May 2016 02:23:14 +0200 |
| parents | 5906661c0421 |
| children |
line wrap: on
line source
#include "DataController.hpp" #include "Exception/Exception.hpp" #include <iostream> #include <QtCore/QList> #include <boost/foreach.hpp> #include <boost/archive/detail/utf8_codecvt_facet.hpp> #include <locale> #include <stdexcept> #include <boost/archive/add_facet.hpp> //#include <codecvt> int main(int argc, char *argv[]) { QStringList paths; /* typedef wchar_t ucs4_t; std::locale old_locale; std::locale utf8_locale(old_locale, new utf8_codecvt_facet<ucs4_t>); // Set a New global locale //std::locale::global(utf8_locale); */ for (int i = 1; i < argc; ++i) { char path_buf[PATH_MAX]; realpath(argv[i], path_buf); paths.push_back(path_buf); } try { if (paths.empty()) { try { DataController dc(false); } catch (std::runtime_error &e) { std::cerr << "Unrecoverable error: " << e.what() << std::endl; exit(1); } } else { foreach(const QString& path, paths) { DataController dc(path, false); } } } catch (Exception& e) { std::cerr << "Unrecoverable error: " << e.toString().toStdString(); exit(1); } }
