#include <creaImageIOTreeHandlerImageAdder.h>
-#include <creaWx.h>
-#include <wx/dir.h>
-#include <wx/filename.h>
+#include <creaImageIOSystem.h>
+//#include <wx/dir.h>
+//#include <wx/filename.h>
-using namespace crea;
+#include "boost/filesystem.hpp"
+
+namespace fs = boost::filesystem;
+
+//using namespace crea;
namespace creaImageIO
{
{
mProgress.Reset();
AddDirectoryRecursor( directory, recurse );
+ GimmickDebugMessage(3,mProgress<<std::endl);
}
//=====================================================================
//=====================================================================
void TreeHandlerImageAdder::AddFile( const std::string& filename )
{
-
+ GimmickDebugMessage(4,"Adding '"<<filename<<"'"<<std::endl);
std::map< std::string, std::string> attr;
mTreeHandler->GetTree().GetDescriptor().BuildAttributeMap(attr);
void TreeHandlerImageAdder::AddDirectoryRecursor(const std::string &dirpath,
bool recursive)
{
+ GimmickDebugMessage(4,"Scanning '"<<dirpath<<"'"<<std::endl);
mProgress.IncNumberScannedDirs();
+ if ( !fs::exists( dirpath ) ) return;
+
+ fs::directory_iterator end_itr; // default construction yields past-the-end
+ for ( fs::directory_iterator itr( dirpath );
+ itr != end_itr;
+ ++itr )
+ {
+ // If is directory & recurse : do recurse
+ if ( fs::is_directory(itr->status()) )
+ {
+ if (recursive) AddDirectoryRecursor( itr->string(), recursive);
+ }
+ else
+ {
+ mProgress.IncNumberScannedFiles();
+ if (IsHandledFile(itr->string()))
+ {
+ mProgress.IncNumberHandledFiles();
+ AddFile( itr->string() );
+ }
+ mProgressSignal(mProgress);
+ if (mProgress.GetStop()) break;
+ }
+ }
+ }
+
+ /*
+
std::string fileName;
std::string dirName = dirpath;
cont = dir.GetNext(&filename);
}
}
-
- }
+
+ */
+
//=======================================================================