Mercurial > dedupe
comparison Apps/updateDeDupe.cpp @ 83:c17475848bf4
Allow for paths to be specified on commandline.
| author | Tom Fredrik Blenning Klaussen <bfg@bfgconsult.no> |
|---|---|
| date | Thu, 10 Oct 2013 14:13:54 +0200 |
| parents | dd086ec3220d |
| children | 5906661c0421 |
comparison
equal
deleted
inserted
replaced
| 82:f507a7240bc9 | 83:c17475848bf4 |
|---|---|
| 1 #include "DataController.hpp" | 1 #include "DataController.hpp" |
| 2 | 2 |
| 3 #include "Exception/Exception.hpp" | 3 #include "Exception/Exception.hpp" |
| 4 | 4 |
| 5 #include <iostream> | 5 #include <iostream> |
| 6 #include <QtCore/QList> | |
| 7 #include <boost/foreach.hpp> | |
| 6 | 8 |
| 7 int main(int argc, char *argv[]) { | 9 int main(int argc, char *argv[]) { |
| 8 | 10 |
| 11 QStringList paths; | |
| 12 | |
| 13 for (int i = 1; i < argc; ++i) { | |
| 14 char path_buf[PATH_MAX]; | |
| 15 realpath(argv[i], path_buf); | |
| 16 paths.push_back(path_buf); | |
| 17 } | |
| 18 | |
| 9 try { | 19 try { |
| 10 DataController dc(false); | 20 if (paths.empty()) { |
| 21 DataController dc(false); | |
| 22 } | |
| 23 else { | |
| 24 foreach(const QString& path, paths) { | |
| 25 DataController dc(path, false); | |
| 26 } | |
| 27 } | |
| 11 } | 28 } |
| 12 catch (Exception& e) { | 29 catch (Exception& e) { |
| 13 std::cerr << "Unrecoverable error: " << e.toString().toStdString(); | 30 std::cerr << "Unrecoverable error: " << e.toString().toStdString(); |
| 14 exit(1); | 31 exit(1); |
| 15 } | 32 } |
