扩展

路径 paths

游戏目录与 ASI 目录路径

Paths.h · plugin::paths

多数接口返回 静态缓冲,下一次调用会覆盖。需要长期保存时拷到 std::string

取游戏与插件目录

GetGameDirPathA / GetPluginDirPathA

窄字符:游戏根目录与本 ASI 所在目录。

static void GetGameDirPathA(char* out);
static const char* GetGameDirPathA();
static void GetPluginDirPathA(char* out);
static const char* GetPluginDirPathA();

宽字符目录

GetGameDirPathW / GetPluginDirPathW
static void GetGameDirPathW(wchar_t* out);
static const wchar_t* GetGameDirPathW();
static void GetPluginDirPathW(wchar_t* out);
static const wchar_t* GetPluginDirPathW();

拼相对路径

GetGameDirRelativePathA / GetPluginDirRelativePathA

根目录 + 相对子路径。也有写入外部缓冲的重载。

static const char* GetGameDirRelativePathA(const char* substring);
static const char* GetPluginDirRelativePathA(const char* substring);

宽字符相对路径

GetGameDirRelativePathW / GetPluginDirRelativePathW
static const wchar_t* GetGameDirRelativePathW(const wchar_t* subpath);
static const wchar_t* GetPluginDirRelativePathW(const wchar_t* subpath);

按类型拼路径

GetDirPath / ePathDir
static const char* GetDirPath(const char* substring, ePathDir dir);
enum ePathDir { DirAbsolute, DirGame, DirPlugin };

本 ASI 文件名

GetPluginFileNameA / GetPluginFileNameW
static const char* GetPluginFileNameA();
static const wchar_t* GetPluginFileNameW();

路径宏

日常写 ini / 资源路径最省事:

GAME_PATH("data\\x.ini")
PLUGIN_PATH("config.ini")
PLUGIN_FILENAME

On this page