init: 自 zomaintain/backend/remote-core 平移独立成库; module path 改为 git.zeroonesoft.cn/golib/remote-core; 修复 ResizeDataType 未导出字段致 json tag 无效的遗留问题

This commit is contained in:
w11
2026-09-19 21:14:49 +08:00
commit 4936f5baf0
8 changed files with 912 additions and 0 deletions
+29
View File
@@ -0,0 +1,29 @@
//go:build windows
package file
import (
"fmt"
"github.com/yusufpapurcu/wmi"
"strings"
)
func getVolumeName(device string) (string, error) {
var volumes []Win32_Volume
query := "SELECT Name, Label FROM Win32_Volume WHERE DriveType = 3" // DriveType = 3 表示磁盘分区
err := wmi.Query(query, &volumes)
if err != nil {
fmt.Println("Failed to query Win32_Volume:", err)
return device, err
}
for _, volume := range volumes {
// fmt.Println("Name:", volume.Name, "Label:", volume.Label)
if strings.ToLower(volume.Name[:2]) == strings.ToLower(device[:2]) {
return volume.Label, nil
}
}
return device, nil
}