Skip to content

Commit 93a0b6d

Browse files
committed
补充 windows 库的meta文件
1 parent 3206446 commit 93a0b6d

File tree

1 file changed

+46
-0
lines changed

1 file changed

+46
-0
lines changed

meta/windows.lua

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
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

0 commit comments

Comments
 (0)