mirror of
https://gitea.msk.dinamika-avia.ru/Constanta-Design/RRJServer.git
synced 2026-03-28 19:55:48 +03:00
107 lines
2.4 KiB
C++
107 lines
2.4 KiB
C++
#include "tools.h"
|
|
|
|
#include <QDir>
|
|
|
|
void Tools::printTime()
|
|
{
|
|
qDebug() << QTime::currentTime().toString("hh:mm:ss.zzz");
|
|
}
|
|
|
|
QString Tools::createLocalPath(QString path)
|
|
{
|
|
qint8 pos = path.indexOf(applicationFolderName);
|
|
|
|
QString localPath = path.remove(0,--pos);
|
|
|
|
//qDebug() << "Local path: " << localPath;
|
|
return localPath;
|
|
}
|
|
|
|
QString Tools::createRootPath(QString path)
|
|
{
|
|
return QDir::currentPath() + path;
|
|
}
|
|
|
|
QString Tools::createSharedPath(QString path){
|
|
return QDir::currentPath()+ "/" + sharedDataFolderName + path;
|
|
}
|
|
|
|
QString Tools::createRealPath(QString path,StreamingVersionData* currentVersionData)
|
|
{
|
|
QString resultPath;
|
|
int index = path.indexOf(currentVersionData->getViewName());
|
|
|
|
if(index != -1)
|
|
{
|
|
resultPath = path.remove(0,index + currentVersionData->getViewName().length());
|
|
resultPath.prepend(buildDataPath + streamingAssetsFolderName);
|
|
}
|
|
else
|
|
{
|
|
resultPath = Tools::createRootPath(path);
|
|
}
|
|
|
|
return resultPath;
|
|
}
|
|
|
|
QString Tools::createStreamingToRealPath(QString path,StreamingVersionData* streamingVersionData)
|
|
{
|
|
QString resultPath = path;
|
|
int index = path.indexOf(streamingAssetsFolderName);
|
|
|
|
if(index != -1)
|
|
{
|
|
resultPath = path.remove(0,index + streamingAssetsFolderName.length());
|
|
resultPath.prepend(QDir::currentPath() + "/" + sharedDataFolderName + "/" + streamingVersionData->getViewName());
|
|
}
|
|
|
|
return resultPath;
|
|
|
|
|
|
}
|
|
|
|
QString Tools::createVersionHashFilepath(QString fileName)
|
|
{
|
|
return staticDataFolderName + "/" + fileName + "Hash.xml";
|
|
}
|
|
|
|
QString Tools::createUpdateFilePath(QString path)
|
|
{
|
|
//qDebug() << "Full path: " << path;
|
|
qint8 pos = path.indexOf(streamingAssetsFolderName);
|
|
|
|
QString localPath = path.remove(0,--pos);
|
|
|
|
//qDebug() << "Local path: " << localPath;
|
|
return localPath;
|
|
}
|
|
|
|
QString Tools::createFolderPath(QString path)
|
|
{
|
|
quint8 pos = path.lastIndexOf("\\");
|
|
|
|
QString folderPath = path.remove(pos,path.length() - pos);
|
|
|
|
return folderPath;
|
|
}
|
|
|
|
QString Tools::createFullPath(QString path)
|
|
{
|
|
QString fullPath;
|
|
qint8 pos = path.indexOf("Application");
|
|
|
|
QString localPath = path.remove(0,--pos);
|
|
|
|
//qDebug() << "CLIENT: localPath" << localPath;
|
|
fullPath = QDir::currentPath() + localPath;
|
|
|
|
return fullPath;
|
|
}
|
|
|
|
bool Tools::checkNonStaticData(QString path)
|
|
{
|
|
if(path.contains(sharedDataFolderName)) return true;
|
|
|
|
return false;
|
|
}
|