bugfix: add behaviour on empty build and shared data

This commit is contained in:
semenov
2025-06-10 11:39:09 +03:00
parent 00d7262251
commit e40a22483a
7 changed files with 72 additions and 6 deletions

View File

@@ -15,6 +15,7 @@
static const QString staticDataFolderName = "StaticData";
static const QString applicationFolderName = "Application";
static const QString sharedDataFolderName = "SharedData";
static const QString projectFolderName = "RRJLoader";
static const QString additionalFilesFolderName = "RRJ-95NEW-100";
static const QString streamingAssetsFolderName = "StreamingAssets";
static const QString versionFolderName = "StreamingVersion";
@@ -23,7 +24,7 @@ static const QString version = staticDataFolderName + "/version.xml";
static const QString versionListFile = staticDataFolderName + "/versionList.xml";
static const QString hashFileName = staticDataFolderName + "/serverHash.xml";
static const QString buildHashName = staticDataFolderName + "/buildHash.xml";
static const QString buildDataPath = "/Application/RRJLoader/RRJ_Data/";
static const QString buildDataPath = "/Application/" + projectFolderName + "/RRJ_Data/";
static const QString tasksAMMfileName = "/tasksAmm.xml";
static const QString tasksFIMfileName = "/tasksFIM.xml";
static const QString clientHash = staticDataFolderName + "/clientHash.xml";

View File

@@ -1,5 +1,6 @@
#include "updatecontroller.h"
UpdateController::UpdateController(QObject *parent) :
QObject(parent),
commonClientHandler(nullptr)
@@ -19,6 +20,12 @@ void UpdateController::initialize(CommonClientHandler *commonClientHandler,DataP
sizeToSend = 0;
assetManager->initialize(this,dataParser);
if (!checkRequiredFolder())
{
emit sigErrorRequired(100);
return;
}
connect(this,&UpdateController::sigLogMessage,logger,&Logger::addTextToLogger,Qt::AutoConnection);
calculateFullHash();
@@ -319,7 +326,7 @@ QList<FileData>* UpdateController::calculateHash(QString path)
{
QFileInfo fileInfo(dirIterator.next());
FileData currentFile;
if(fileInfo.isDir() && !fileInfo.fileName().startsWith(".") && fileInfo.fileName() != "RRJLoader")
if(fileInfo.isDir() && !fileInfo.fileName().startsWith(".") && fileInfo.fileName() != projectFolderName)
{
currentFile.path = Tools::createLocalPath(fileInfo.absoluteFilePath());
currentFile.hash = "FOLDER";
@@ -536,7 +543,6 @@ QList<FileData> UpdateController::getFileSendList()
return sendList;
}
QList<FileData> UpdateController::getClientDataList() const
{
return clientDataList;
@@ -552,6 +558,17 @@ void UpdateController::clearCurrentDataInfo()
delete dataInfo;
}
bool UpdateController::checkRequiredFolder()
{
bool required = true;
QDir buildDir(buildPath + "/" + projectFolderName);
if (!buildDir.exists()) required = false;
QDir baseSharedDir(sharedDataPath + "/" + baseNameVersion);
if (!baseSharedDir.exists()) required = false;
return required;
}
UpdateController::~UpdateController()
{

View File

@@ -9,6 +9,8 @@
#include <QDebug>
#include <QDataStream>
#include <QMutex>
#include <QApplication>
#include <QMessageBox>
#include <Systems/Parsers/dataparser.h>
#include <Data/typesDataServerClient.h>
@@ -66,6 +68,7 @@ public slots:
signals:
void sigLogMessage(QString message);
void sigErrorRequired(int code);
private:
QList<FileData> clientDataList;
@@ -94,6 +97,7 @@ private:
void saveHash(QString fileName,QList<FileData> *fileList);
void loadHash();
void CalculateSizeToSend(QList<FileData> diffList);
bool checkRequiredFolder();
};
#endif // UPDATECONTROLLER_H