Mercurial > dedupe
comparison DataController.cpp @ 84:848496a57039
If a filepath cannot be interpreted, make this a non-critical error.
| author | Tom Fredrik Blenning Klaussen <bfg@bfgconsult.no> |
|---|---|
| date | Thu, 10 Oct 2013 14:14:20 +0200 |
| parents | 9744ec195be3 |
| children | cfd2a417475a |
comparison
equal
deleted
inserted
replaced
| 83:c17475848bf4 | 84:848496a57039 |
|---|---|
| 28 { | 28 { |
| 29 #if USE_BOOST_FIND | 29 #if USE_BOOST_FIND |
| 30 namespace fs = boost::filesystem; | 30 namespace fs = boost::filesystem; |
| 31 fs::path someDir(dir.path().toStdString()); | 31 fs::path someDir(dir.path().toStdString()); |
| 32 fs::directory_iterator end_iter; | 32 fs::directory_iterator end_iter; |
| 33 boost::system::error_code ec; | |
| 33 | 34 |
| 34 if ( fs::exists(someDir) && fs::is_directory(someDir)) { | 35 if ( fs::exists(someDir) && fs::is_directory(someDir)) { |
| 35 for( fs::directory_iterator dir_iter(someDir) ; | 36 for( fs::directory_iterator dir_iter(someDir, ec) ; |
| 36 dir_iter != end_iter ; ++dir_iter) { | 37 dir_iter != end_iter ; ++dir_iter) { |
| 37 if (fs::is_directory(dir_iter->status()) ) { | 38 std::wstring wpath; |
| 38 findFiles(QString::fromStdWString(dir_iter->path().wstring()), list); | 39 try { |
| 39 } | 40 wpath = dir_iter->path().wstring(); |
| 40 if (fs::is_regular_file(dir_iter->status()) ) { | 41 } |
| 41 list << QString::fromStdWString(dir_iter->path().wstring()); | 42 catch (boost::system::system_error &e) { |
| 43 printf("%s\n", dir_iter->path().c_str()); | |
| 44 std::cout << e.what() <<std::endl; | |
| 45 } | |
| 46 if (!wpath.empty()) { | |
| 47 if (fs::is_directory(dir_iter->status()) ) { | |
| 48 findFiles(QString::fromStdWString(wpath), list); | |
| 49 } | |
| 50 if (fs::is_regular_file(dir_iter->status()) ) { | |
| 51 list << QString::fromStdWString(wpath); | |
| 52 } | |
| 42 } | 53 } |
| 43 } | 54 } |
| 44 } | 55 } |
| 45 #else | 56 #else |
| 46 foreach(QString filename, dir.entryList(QDir::NoDotAndDotDot | QDir::Dirs)) { | 57 foreach(QString filename, dir.entryList(QDir::NoDotAndDotDot | QDir::Dirs)) { |
