GrabBag/BeltTearingServer/PathManager.h
2025-09-10 00:31:27 +08:00

48 lines
1.3 KiB
C++
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

#ifndef PATHMANAGER_H
#define PATHMANAGER_H
#include <QString>
/**
* @brief 路径管理器类,统一管理皮带撕裂服务器的配置文件路径
*
* 该类负责根据不同操作系统提供合适的配置文件存储路径:
* - Windows: 程序目录
* - Linux: 用户配置目录 (~/.config/BeltTearingServer/)
*/
class PathManager
{
public:
/**
* @brief 获取配置文件(BeltTearingConfig.xml)的完整路径
* @return 配置文件的完整路径
*/
static QString GetConfigFilePath();
private:
/**
* @brief 确保配置目录存在,如果不存在则创建
* @return 成功创建或目录已存在返回true失败返回false
*/
static bool EnsureConfigDirectoryExists();
/**
* @brief 获取应用程序配置目录路径
* @return 配置目录的完整路径
*/
static QString GetAppConfigDirectory();
/**
* @brief 获取程序目录路径
* @return 程序目录的完整路径
*/
static QString GetProgramDirectory();
/**
* @brief 获取用户配置目录路径仅Linux系统
* @return 用户配置目录的完整路径
*/
static QString GetUserConfigDirectory();
};
#endif // PATHMANAGER_H