COMPASSi/trunk/code/inc/Util/include/PathUtil.h

57 lines
1.1 KiB
C
Raw Permalink Normal View History

2025-06-25 15:06:42 +08:00
#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();
2025-06-26 15:07:17 +08:00
static void deleteFile(const QString &filePath);
2025-06-25 15:06:42 +08:00
private:
PathUtil();
Q_DISABLE_COPY(PathUtil)
};
#ifdef __cplusplus
}
#endif
#endif