feat(scan): 添加自定义扫描目录选择功能
- 在扫描页面添加目录输入框和选择按钮 - 实现文件系统浏览器,支持Windows盘符和目录浏览 - 添加扫描目录参数传递到后端服务 - 显示当前扫描目录路径信息 - 修复前端空数组访问错误 - 更新文档说明扫描功能变化
This commit is contained in:
@@ -0,0 +1,20 @@
|
||||
//go:build windows
|
||||
|
||||
package api
|
||||
|
||||
import "golang.org/x/sys/windows"
|
||||
|
||||
// listLogicalDrives 返回 Windows 所有逻辑盘符(如 C:\、D:\)
|
||||
func listLogicalDrives() []string {
|
||||
bits, err := windows.GetLogicalDrives()
|
||||
if err != nil {
|
||||
return nil
|
||||
}
|
||||
drives := make([]string, 0, 26)
|
||||
for i := 0; i < 26; i++ {
|
||||
if bits&(1<<uint(i)) != 0 {
|
||||
drives = append(drives, string(rune('A'+i))+":\\")
|
||||
}
|
||||
}
|
||||
return drives
|
||||
}
|
||||
Reference in New Issue
Block a user