diff --git a/clean_nvim_lsp.sh b/clean_nvim_lsp.sh index 67568d8..08e3e8a 100755 --- a/clean_nvim_lsp.sh +++ b/clean_nvim_lsp.sh @@ -6,4 +6,5 @@ rm -fr build rm -fr CMakeCache.txt CMakeFiles Makefile cmake_install.cmake \ compile_commands.json TombRaiderLinuxLauncher \ .cache TombRaiderLinuxLauncher_autogen \ - TombRaiderLinuxLauncherTest_autogen CTestTestfile.cmake + TombRaiderLinuxLauncherTest_autogen CTestTestfile.cmake \ + .gdb .gdbinit diff --git a/src/FileManager.cpp b/src/FileManager.cpp index eadb502..3095cf3 100644 --- a/src/FileManager.cpp +++ b/src/FileManager.cpp @@ -21,6 +21,8 @@ #include #include #include "gameTree.hpp" +#include "miniz.h" +#include "miniz_zip.h" bool FileManager::setUpCamp(const QString& levelDir, const QString& gameDir) { bool status = true; @@ -212,6 +214,7 @@ int FileManager::checkFileInfo(const QString& file, bool lookGameDir) { } bool FileManager::linkGameDir(const QString& levelDir, const QString& gameDir) { + bool status = false; const QString levelPath = QString("%1%2") .arg(m_levelDir.absolutePath(), levelDir); const QString gamePath = QString("%1%2") @@ -228,16 +231,17 @@ bool FileManager::linkGameDir(const QString& levelDir, const QString& gameDir) { QFile::remove(gamePath); if (QFile::link(levelPath, gamePath)) { qDebug() << "Symbolic link created successfully."; - return 0; + status = true; } else { qDebug() << "Failed to create symbolic link."; - return 1; + status = false; } } else { qDebug() << "Failed to create symbolic link."; - return 1; + status = false; } } + return status; } bool FileManager::makeRelativeLink( diff --git a/src/FileManager.hpp b/src/FileManager.hpp index 5dcb28c..b6a720b 100644 --- a/src/FileManager.hpp +++ b/src/FileManager.hpp @@ -20,8 +20,6 @@ #include #include #include -#include "miniz.h" -#include "miniz_zip.h" class FileManager : public QObject { Q_OBJECT diff --git a/src/Model.cpp b/src/Model.cpp index 80b2b54..d7c5f21 100644 --- a/src/Model.cpp +++ b/src/Model.cpp @@ -124,19 +124,20 @@ int Model::getItemState(int id) { } bool Model::setLink(int id) { + bool status = false; if (id < 0) { id = -id; const QString s = "/Original.TR" + QString::number(id); if (fileManager.checkDir(s, false )) - return fileManager.linkGameDir(s, getGameDirectory(id)); + status = fileManager.linkGameDir(s, getGameDirectory(id)); } else if (id > 0) { const QString s = "/"+QString::number(id) + ".TRLE"; const int t = data.getType(id); if (fileManager.checkDir(s, false )) - return fileManager.linkGameDir(s, getGameDirectory(t)); + status = fileManager.linkGameDir(s, getGameDirectory(t)); } - return false; + return status; } void Model::setupGame(int id) { @@ -187,7 +188,7 @@ bool Model::getGame(int id) { if (fileManager.checkFile(zipData.name, false)) { qDebug() << "File exists:" << zipData.name; - const QString& sum = fileManager.calculateMD5(zipData.name, false); + const QString sum = fileManager.calculateMD5(zipData.name, false); if (sum != zipData.md5sum) { downloader.run(); status = downloader.getStatus(); @@ -204,7 +205,19 @@ bool Model::getGame(int id) { status = downloader.getStatus(); } if (status == 0) { - fileManager.extractZip(zipData.name, QString::number(id)+".TRLE"); + /* when the problem about updateing sum is solved it should verify + * the download md5sum can just change on trle so it should just + * update it + const QString sum = fileManager.calculateMD5(zipData.name, false); + if (sum == zipData.md5sum) { + const QString directory = QString::number(id)+".TRLE"; + fileManager.extractZip(zipData.name, directory); + instructionManager.executeInstruction(id); + return true; + } + */ + const QString directory = QString::number(id)+".TRLE"; + fileManager.extractZip(zipData.name, directory); instructionManager.executeInstruction(id); return true; }