From 60067c5195c2aff6e7de8faef1cecf25f32802e4 Mon Sep 17 00:00:00 2001 From: caballero Date: Fri, 26 Jun 2009 13:08:39 +0000 Subject: [PATCH] New folder structure to comply with Linux and Mac OS standards and documentation of synchronization class. --- install/CMakeLists.txt | 2 ++ src2/CMakeLists.txt | 2 +- src2/creaImageIOGimmick.cpp | 26 +++++++++++++++----- src2/creaImageIOGimmick.h | 5 +++- src2/creaImageIOSettings.cpp | 2 +- src2/creaImageIOSynchron.h | 34 ++++++++++++++++++++++++-- src2/data/localdatabase_Descriptor.txt | 4 --- 7 files changed, 60 insertions(+), 15 deletions(-) diff --git a/install/CMakeLists.txt b/install/CMakeLists.txt index 3e14d9d..8e179f2 100644 --- a/install/CMakeLists.txt +++ b/install/CMakeLists.txt @@ -65,6 +65,8 @@ IF (WIN32) ENDIF (WIN32) + + INSTALL( FILES ${PROJECT_SOURCE_DIR}/src2/data/localdatabase_Descriptor.txt DESTINATION bin/Shared/gimmick ) IF (BUILD_STANDALONE_INSTALLER) diff --git a/src2/CMakeLists.txt b/src2/CMakeLists.txt index 9aded62..3fe2c57 100644 --- a/src2/CMakeLists.txt +++ b/src2/CMakeLists.txt @@ -146,7 +146,7 @@ SET(${LIBRARY_NAME}_ADDITIONAL_USE_FILE CREA_ADVANCED_INSTALL_LIBRARY_FOR_CMAKE(${LIBRARY_NAME}) SET(INPUT_DATA_DIR ${PROJECT_SOURCE_DIR}/src2/data) -SET(OUTPUT_DATA_DIR ${PROJECT_BINARY_DIR}/data) +SET(OUTPUT_DATA_DIR ${PROJECT_BINARY_DIR}/bin/Shared/gimmick) CREA_CPDIR(${INPUT_DATA_DIR} ${OUTPUT_DATA_DIR}) diff --git a/src2/creaImageIOGimmick.cpp b/src2/creaImageIOGimmick.cpp index 1e7b74a..5549175 100644 --- a/src2/creaImageIOGimmick.cpp +++ b/src2/creaImageIOGimmick.cpp @@ -39,6 +39,12 @@ namespace creaImageIO } //============================================================== + //============================================================== + void Gimmick::Initialize(const std::string& path) + { + mDescriptorPath=path; + Initialize(); + } //============================================================== void Gimmick::Initialize() @@ -48,14 +54,14 @@ namespace creaImageIO CreateUserSettingsDirectory(); // Sets the current directory to the home dir mCurrentDirectory = GetHomeDirectory(); - mSynchronizer= new Synchronizer(GetUserSettingsDirectory()); + mSynchronizer= new Synchronizer(GetUserSettingsDirectory()+"Shared/gimmick/"); mSettings = new Settings(mCurrentDirectory); std::string dbpath = GetLocalDatabasePath(); // Create or open local database - std::string dpath= mCurrentDirectory + "/.gimmick/localdatabase_Descriptor.txt"; + std::string dpath= mCurrentDirectory + "/.gimmick/Shared/gimmick/localdatabase_Descriptor.txt"; boost::algorithm::replace_all( dpath, INVALID_FILE_SEPARATOR , VALID_FILE_SEPARATOR); @@ -216,7 +222,7 @@ namespace creaImageIO if (mLocalDatabasePath.size()==0) { mLocalDatabasePath = GetUserSettingsDirectory(); - mLocalDatabasePath += "local_database.sqlite3"; + mLocalDatabasePath += "Shared/gimmick/local_database.sqlite3"; boost::algorithm::replace_all( mLocalDatabasePath, INVALID_FILE_SEPARATOR , VALID_FILE_SEPARATOR); @@ -232,7 +238,7 @@ namespace creaImageIO if (mTimestampDatabasePath.size()==0) { mTimestampDatabasePath = GetUserSettingsDirectory(); - mTimestampDatabasePath += "timestamp_database.sqlite3"; + mTimestampDatabasePath += "Shared/gimmick/timestamp_database.sqlite3"; boost::algorithm::replace_all( mTimestampDatabasePath, INVALID_FILE_SEPARATOR , VALID_FILE_SEPARATOR); @@ -259,18 +265,26 @@ namespace creaImageIO boost::algorithm::replace_all( setDir, INVALID_FILE_SEPARATOR , VALID_FILE_SEPARATOR); + setDir+="Shared/"; + boost::filesystem::create_directory( setDir ); + setDir+="gimmick/"; + boost::filesystem::create_directory( setDir ); setDir+="localdatabase_Descriptor.txt"; - //if(!boost::filesystem::is_regular_file(setDir)) //JPRX + if(!boost::filesystem::is_regular(setDir)) { char name[PATH_MAX]; //EED int err = GetBinaryDirectory(name, PATH_MAX); crea::System::GetAppPath(name,PATH_MAX); + std::cout<& files , const std::string& refdb); + ///Gets the list of ignored files void GetIgnoredFiles(const std::string& key, std::vector &ignoreList); + ///Gets the attribute that matches the parameters std::string GetAttribute(const std::string& attribute, const std::string& table, const std::string& searchParam, const std::string& searchValue, const std::string& refdb); + ///Sets an attribute to an entry that matches the given parameters void SetAttribute(const std::string& attribute, const std::string& table, const std::string& value, const std::string& searchParam, const std::string& searchValue, const std::string& refdb); + ///The current AddList std::vector mAddList; + ///The current RemoveList std::vector mIgnoreList; private : /// The DB CppSQLite3DB* mDB; + ///Path of the current database std::string pathDB; + ///Creates a new database void CreateDB(); + ///Updates the AddList void UpdateAddList(const std::string& refdb); + ///Cleans the list in case operations are no longer useful (0 added files) void CleanList(const std::string& refdb); + ///Cleans the name (changes slashes and backslashes according to the system) void CleanName(std::string& str) const; - + ///Gets the ignore list std::vector GetIgnoreList(const std::string &i_key); }; diff --git a/src2/data/localdatabase_Descriptor.txt b/src2/data/localdatabase_Descriptor.txt index 8907250..e3338aa 100644 --- a/src2/data/localdatabase_Descriptor.txt +++ b/src2/data/localdatabase_Descriptor.txt @@ -34,15 +34,11 @@ Image D 0x0020 0x0013 3 D 0x0028 0x0010 3 D 0x0028 0x0011 3 -D 0x0028 0x0012 3 -D 0x0028 0x0002 3 D 0x0028 0x0008 3 -D 0x0028 0x0004 3 D 0x0028 0x0103 3 D 0x0020 0x0032 3 D 0x0020 0x0037 3 D 0x0020 0x1041 3 -D 0x0028 0x0006 3 D 0x0028 0x0030 3 D 0x0028 0x0100 3 D 0x0028 0x0101 3 -- 2.45.1