-
Notifications
You must be signed in to change notification settings - Fork 1
/
Global.h
42 lines (33 loc) · 840 Bytes
/
Global.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
#pragma once
#include <QDir>
#include <QMessageBox>
#include "FileHelper.h"
#pragma execution_character_set("utf-8")
#define debugout qDebug()
struct CPath
{
public:
CPath()
{
};
void init(QString fullPath, bool ensureDataDir = true)
{
this->appPath = fullPath;
QDir appDir(appPath);
QString appName = appDir.dirName();
QString dir = appPath.left(appPath.length() - appName.length());
this->appDir = dir;
appName = appName.left(appName.lastIndexOf(".exe"));
this->appName = appName;
dataBase = this->appDir + "data/";
cache = dataBase + "cache/";
userBase = this->appDir + "users/";
if (ensureDataDir)
{
CFileHelper::ensureDirExist(dataBase);
CFileHelper::ensureDirExist(cache);
}
}
QString appPath, appDir, appName, dataBase, cache, userBase, userData, userFiles;
};
extern CPath gPath;