Index: sources/storage/FileHandler.cpp =================================================================== diff -u -r80b5e8f1ebb90c03c37d90d90cd2da3bd95d6803 -r4fc7cdc599de191e91296623ec783542b7a3c7b8 --- sources/storage/FileHandler.cpp (.../FileHandler.cpp) (revision 80b5e8f1ebb90c03c37d90d90cd2da3bd95d6803) +++ sources/storage/FileHandler.cpp (.../FileHandler.cpp) (revision 4fc7cdc599de191e91296623ec783542b7a3c7b8) @@ -319,6 +319,36 @@ } /*! + * \brief FileHandler::isDirSame + * \details Compare the two folder's content + * \param vDir1 - directory path 1 + * \param vDir2 - directory path 2 + * \return true if the two directories are the same, false otherwise + */ +bool FileHandler::isDirSame(const QString &vDir1, const QString &vDir2) +{ + // disabled coco begin validated: This needs user interaction to check the file system + // has been tested manually since currently it is the only place it has been used. + bool isSame = false; + QString cmd = "diff"; + QStringList arguments; + arguments << vDir1 << vDir2; + + QProcess diffProcess; + diffProcess.start(cmd, arguments); + + bool processCompleted = diffProcess.waitForFinished(); + if ( processCompleted ) + { + QString output = diffProcess.readAll(); + isSame = output.isEmpty(); // non empty indicate difference exists + //DEBUG: qDebug()<< output << output.isEmpty(); + } + + return isSame; +} + +/*! * \brief FileHandler::find * \details The function to find files. * It mainly been implemented to find the files are using some amount of total storage in the vPath by percentage,