# define PATH_MAX 2048
#endif
+#ifdef _RELWITHDEBINFO
+#define new DEBUG_NEW
+#endif
+
+
#ifdef _DEBUG
#define new DEBUG_NEW
#endif
RegisterGimmickMessageTypes();
mSettings=0;
mSynchronizer=0;
+ mLocalDescpName = "localdatabase_Descriptor.dscp";
+ mLocalDBName = "Local database";
}
//==============================================================
//==============================================================
//==============================================================
- void Gimmick::Initialize(const std::string& path)
+ void Gimmick::Initialize(const std::string i_namedescp, const std::string i_namedb)
{
+ mLocalDescpName = i_namedescp;
+ mLocalDBName = i_namedb;
Initialize();
}
//==============================================================
void Gimmick::Initialize()
{
- std::string i_nameDB = "Local database";
+ std::string i_nameDB = mLocalDBName;
// Create the UserSettings dir if does not exist
CreateUserSettingsDirectory();
// Sets the current directory to the home dir
std::string dbpath = GetLocalDatabasePath();
// Create or open local database
- std::string dpath= mCurrentDirectory + "/.gimmick/Shared/gimmick/localdatabase_Descriptor.dscp";
+ std::string dpath= mCurrentDirectory + "/.gimmick/Shared/gimmick/" + mLocalDescpName;
boost::algorithm::replace_all( dpath,
INVALID_FILE_SEPARATOR ,
VALID_FILE_SEPARATOR);
//==============================================================
void Gimmick::Finalize()
{
-
- // delete SQLiteTreeHandler Object
- for( TreeHandlerMapType::const_iterator it = mTreeHandlerMap.begin();
- it!= mTreeHandlerMap.end();
- ++it)
- {
- delete it->second;
- }
+ if(mTreeHandlerMap.size() >0)
+ {
+ // delete SQLiteTreeHandler Object
+ for( TreeHandlerMapType::const_iterator it = mTreeHandlerMap.begin();
+ it!= mTreeHandlerMap.end();
+ ++it)
+ {
+ delete it->second;
+ }
+ }
}
//==============================================================
boost::filesystem::create_directory( setDir );
setDir+="gimmick/";
boost::filesystem::create_directory( setDir );
- setDir+="localdatabase_Descriptor.dscp";
+ setDir+=mLocalDescpName;
if(!boost::filesystem::is_regular(setDir))
{
// The following stuff works on Linux, NOT CHECKED on Windows // JPR
#if defined(_WIN32)
- path+="/bin/Shared/gimmick/localdatabase_Descriptor.dscp";
+ path+="/bin/Shared/gimmick/";
+ path+=mLocalDescpName;
#else
- path+="/Shared/gimmick/localdatabase_Descriptor.dscp";
+ path+="/Shared/gimmick/";
+ path+= mLocalDescpName;
#endif
std::cout <<"From: " << path <<std::endl;
std::cout <<"To: " << setDir <<std::endl;