Private
Public Access
1
0

修复:常用系统路径获取,支持桌面文档等快捷访问

This commit is contained in:
2026-01-26 02:15:16 +08:00
parent 5ef483c830
commit 84ebc1226b
2 changed files with 54 additions and 18 deletions

18
app.go
View File

@@ -9,6 +9,7 @@ import (
"go-desk/internal/storage"
"go-desk/internal/system"
"os"
"path/filepath"
"strings"
"github.com/wailsapp/wails/v2/pkg/runtime"
@@ -132,6 +133,23 @@ func (a *App) GetEnvVars() (map[string]string, error) {
return envVars, nil
}
// GetCommonPaths 获取常用系统路径
func (a *App) GetCommonPaths() (map[string]string, error) {
homeDir, err := os.UserHomeDir()
if err != nil {
return nil, err
}
return map[string]string{
"home": homeDir,
"desktop": filepath.Join(homeDir, "Desktop"),
"documents": filepath.Join(homeDir, "Documents"),
"downloads": filepath.Join(homeDir, "Downloads"),
"root_c": "C:\\",
"root_d": "D:\\",
}, nil
}
// ========== 数据库连接管理接口 ==========
// initAPIs 初始化所有API在startup中调用