57 lines
1.1 KiB
C++
57 lines
1.1 KiB
C++
#ifndef PATHUTIL_H
|
||
#define PATHUTIL_H
|
||
|
||
#include <QString>
|
||
#include <QSettings>
|
||
#include "UtilityGlobal.h"
|
||
#include <filesystem>
|
||
#include "nlohmann/json.hpp"
|
||
using json = nlohmann::json;
|
||
|
||
#ifdef __cplusplus
|
||
extern"C"{
|
||
#endif
|
||
|
||
// 路径帮助类,用于获取bin、data、config、trans等文件夹路径
|
||
class UTILITY_API PathUtil
|
||
{
|
||
public:
|
||
/** end with '/' */
|
||
static const QString bin_dir();
|
||
|
||
/** end with '/' */
|
||
static const QString& data_dir();
|
||
|
||
/** end with '/' */
|
||
static const QString& config_dir();
|
||
|
||
/** end with '/' */
|
||
static const QString& trans_dir();
|
||
|
||
static const QString get_default_path();
|
||
|
||
static std::string jsonContainsKeyToString(const json &j ,std::string strkey);
|
||
|
||
static QString jsonContainsKeyToQString(const json &j ,std::string strkey);
|
||
|
||
static int jsonContainsKeyToInt(const json &j ,std::string strkey);
|
||
|
||
static double jsonContainsKeyToDouble(const json &j ,std::string strkey);
|
||
|
||
static QString getEndMark();
|
||
|
||
static QString getLogEndLine();
|
||
|
||
static void deleteFile(const QString &filePath);
|
||
|
||
private:
|
||
PathUtil();
|
||
Q_DISABLE_COPY(PathUtil)
|
||
};
|
||
|
||
#ifdef __cplusplus
|
||
}
|
||
#endif
|
||
|
||
#endif
|