mirror of
https://gitea.msk.dinamika-avia.ru/Constanta-Design/RRJServer.git
synced 2026-03-28 19:55:48 +03:00
Переделано под один мега-проект LMS с общим CMakeLists.txt
This commit is contained in:
89
ServerLMS/Systems/tools.cpp
Normal file
89
ServerLMS/Systems/tools.cpp
Normal file
@@ -0,0 +1,89 @@
|
||||
#include "tools.h"
|
||||
|
||||
#include <QDir>
|
||||
|
||||
void Tools::printTime()
|
||||
{
|
||||
qDebug() << QTime::currentTime().toString("hh:mm:ss.zzz");
|
||||
}
|
||||
|
||||
|
||||
QString Tools::getTime()
|
||||
{
|
||||
return 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::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;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user