mImageAdder.SetCurrentDatabase(d);
mImageAdder.SetTreeHandler(GetTreeHandler(d));
mImageAdder.SetSynchronizer(mSynchronizer);
- mImageAdder.AddFiles(filenames);
+ mImageAdder.AddFiles(filenames);
}
//========================================================================
#include <creaImageIOSynchron.h>
#include <creaImageIOSystem.h>
#include <boost/filesystem.hpp>
+#include <boost/algorithm/string.hpp>
+//namespace fs = boost::filesystem;
-namespace fs = boost::filesystem;
//=====================================================================
//=====================================================================
void Synchronizer::Initialize()
{
- if (!fs::exists(pathDB))
+ if (!boost::filesystem::exists(pathDB))
{
CreateDB();
}
bool Synchronizer::isIndexed(const std::string filename)
{
bool valid = true;
+ std::string name(filename);
+ boost::algorithm::replace_all( name,"\\" , "/");
std::map <std::string, bool>::iterator it_list = mList.begin();
for(;it_list != mList.end(); it_list++)
{
- if(it_list->first == filename)
+ if(it_list->first == name)
{
valid = false;
break;
unsigned int nbf = filenames.size();
std::vector<std::string>::const_iterator i;
+ mSynchronizer->GetList();
for (i=filenames.begin();i!=filenames.end();++i)
{
if (IsHandledFile(*i))
{
mProgress.IncNumberHandledFiles();
- mSynchronizer->InsertAddOp((*i),"0","1",mCurrentDB);
- std::string addKey=mSynchronizer->GetAttribute("ADD_KEY","ADD_OPS","PATH",(*i),mCurrentDB);
- std::stringstream removedOn;
- removedOn<<time(0);
- mSynchronizer->InsertIgnoreFile(addKey,(*i),"0",removedOn.str(),mCurrentDB);
- AddFile(*i);
+ if(mSynchronizer->isIndexed(*i))
+ {
+ mSynchronizer->InsertAddOp((*i),"0","1",mCurrentDB);
+ std::string addKey=mSynchronizer->GetAttribute("ADD_KEY","ADD_OPS","PATH",(*i),mCurrentDB);
+ std::stringstream removedOn;
+ removedOn<<time(0);
+ mSynchronizer->InsertIgnoreFile(addKey,(*i),"0",removedOn.str(),mCurrentDB);
+ AddFile(*i);
+ }
}
mProgressSignal(mProgress);
if (mProgress.GetStop()) break;
#define __creaImageIOTreeHandlerImageAdder_h_INCLUDED__
#include <creaImageIOTreeHandler.h>
-#include <creaImageIOTimestampDatabaseHandler.h>
#include <creaImageIOSynchron.h>
#include <creaImageIOImageReader.h>
//#include <creaImageIOImageWriter.h>
~TreeHandlerImageAdder();
/// Sets the TreeHandler
void SetTreeHandler(TreeHandler* tree) { mTreeHandler = tree;}
- /// Sets the TimestampDatabaseHandler
- void SetTimestampHandler(TimestampDatabaseHandler* tdh) { mTimestampHandler = tdh;}
+
/// Sets the synchronizer
void SetSynchronizer(Synchronizer* s){mSynchronizer=s;}
/// Sets the synchronizer
const std::string &addKey);
TreeHandler* mTreeHandler;
- TimestampDatabaseHandler* mTimestampHandler;
Synchronizer* mSynchronizer;
ImageReader mReader;
//ImageWriter mWriter;