Index: sources/storage/FileHandler.cpp =================================================================== diff -u -r5687815256ae070a9a207107088e3f72dd464da0 -rca40cfec5ff6b63d4685ceb2e62ebe9366adcfd0 --- sources/storage/FileHandler.cpp (.../FileHandler.cpp) (revision 5687815256ae070a9a207107088e3f72dd464da0) +++ sources/storage/FileHandler.cpp (.../FileHandler.cpp) (revision ca40cfec5ff6b63d4685ceb2e62ebe9366adcfd0) @@ -131,6 +131,30 @@ } /*! + * \brief FileHandler::backupFile + * \details Calls the gzip command + * The vPrepend file is prepended to the vDestination file, + * gets compressed with the name of the vDestination file appended with .gz + * The two files of vPrepend and vDestination will be delitted in this function. + * \param vSource - file to be prepended to the vDestination file before compression. + * \param vDestination - the file to be prepared and compressed, also the base name of the compressed file. + * \return NOT FINALIZED YET. + * \note THIS FUNCTION IS NOT TESTED DUE TO ISSUES IN RETURN VALUE CHECK OF TWO PIPED COMMAND. + */ +int FileHandler::backupFile(const QString &vPrepend, const QString &vDestination) +{ + QString cmd = QString("cat %1 %2 | gzip > %2.%3") + .arg(vPrepend) + .arg(vDestination) + .arg(Storage::gzipExt) + ; + int result = QProcess::execute(cmd, {}); + QFile::remove(vPrepend); + QFile::remove(vDestination); + return result; +} + +/*! * \brief FileHandler::copyFolder * \details Copies all the file and folders recursively. * \param vSource - The source folder