File tree Expand file tree Collapse file tree 2 files changed +52
-5
lines changed
Expand file tree Collapse file tree 2 files changed +52
-5
lines changed Original file line number Diff line number Diff line change 22
33--- 平台信息(模块返回的是表而不是类)
44--- @class bee.platform
5- --- @field os string 操作系统名称 : " windows" | " android" | " linux" | " netbsd" | " freebsd" | " openbsd" | " ios" | " macos" | " unknown"
6- --- @field Compiler string 编译器类型 : " clang" | " msvc" | " gcc" | " unknown"
5+ --- @field os " windows" | " android" | " linux" | " netbsd" | " freebsd" | " openbsd" | " ios" | " macos" | " unknown" 操作系统名称
6+ --- @field Compiler " clang" | " msvc" | " gcc" | " unknown" 编译器类型
77--- @field CompilerVersion string 编译器版本字符串
8- --- @field CRT string C 运行时库类型 : " bionic" | " msvc" | " libstdc++" | " libc++" | " unknown"
8+ --- @field CRT " bionic" | " msvc" | " libstdc++" | " libc++" | " unknown" C 运行时库类型
99--- @field CRTVersion string C 运行时库版本字符串
10- --- @field Arch string 架构 : " arm64" | " x86" | " x86_64" | " arm" | " riscv" | " wasm32" | " wasm64" | " mips64el" | " loongarch64" | " ppc64" | " ppc" | " unknown"
10+ --- @field Arch " arm64" | " x86" | " x86_64" | " arm" | " riscv" | " wasm32" | " wasm64" | " mips64el" | " loongarch64" | " ppc64" | " ppc" | " unknown" 架构
1111--- @field DEBUG boolean 是否为调试构建
1212--- @field os_version bee.platform.os_version 操作系统版本信息
13+ local platform = {}
1314
1415--- 操作系统版本信息
1516--- @class bee.platform.os_version
1617--- @field major integer 主版本号
1718--- @field minor integer 次版本号
1819--- @field revision integer 修订版本号
1920
20- return {}
21+ return platform
Original file line number Diff line number Diff line change 1+ --- @meta bee.windows
2+
3+ --- Windows 平台特定功能库
4+ --- @class bee.windows
5+ local windows = {}
6+
7+ --- 将 UTF-8 字符串转换为 ANSI (GBK) 编码
8+ --- @param str string UTF-8 编码的字符串
9+ --- @return string # ANSI (GBK) 编码的字符串
10+ function windows .u2a (str )
11+ end
12+
13+ --- 将 ANSI (GBK) 字符串转换为 UTF-8 编码
14+ --- @param str string ANSI (GBK ) 编码的字符串
15+ --- @return string # UTF-8 编码的字符串
16+ function windows .a2u (str )
17+ end
18+
19+ --- 设置文件的文本/二进制模式
20+ --- @param file file* 文件句柄
21+ --- @param mode string 模式字符串,' t' 表示文本模式,' b' 表示二进制模式
22+ --- @return boolean # 是否设置成功
23+ function windows .filemode (file , mode )
24+ end
25+
26+ --- 判断文件句柄是否为 TTY (终端)
27+ --- @param file file* 文件句柄
28+ --- @return boolean # 是否为终端
29+ function windows .isatty (file )
30+ end
31+
32+ --- 向 Windows 控制台写入内容
33+ --- 使用 WriteConsoleW API,能正确处理 UTF-16 编码
34+ --- @param file file* 文件句柄(通常为 io.stdout 或 io.stderr )
35+ --- @param msg string 要写入的消息
36+ --- @return integer # 写入的字符数
37+ function windows .write_console (file , msg )
38+ end
39+
40+ --- 检测磁盘驱动器是否为 SSD
41+ --- @param drive string 驱动器名称,例如 " C:" 或 " C"
42+ --- @return boolean # 是否为 SSD
43+ function windows .is_ssd (drive )
44+ end
45+
46+ return windows
You can’t perform that action at this time.
0 commit comments