chore: import Local-Cursor v1.1.8 source snapshot

Includes the current working directory changes. Historical commits and release binaries are excluded to limit Gitea storage.
Source base: d7515973fbfd6dd2001fa156c483455b8081c7cb
This commit is contained in:
FuDie0915
2026-11-10 01:24:28 +08:00
commit db73cf5a39
337 changed files with 147502 additions and 0 deletions

88
internal/client/config.go Normal file
View File

@@ -0,0 +1,88 @@
package client
import (
"context"
"cursor/internal/appdata"
serverconfig "cursor/internal/backend/server/config"
"github.com/wailsapp/wails/v3/pkg/application"
)
// UserConfig 定义了当前模块中的 UserConfig 类型。
type UserConfig = serverconfig.Config
// LoadUserConfig 用于处理与 LoadUserConfig 相关的逻辑。
func (s *ProxyService) LoadUserConfig() (UserConfig, error) {
if s == nil {
return serverconfig.DefaultConfig(), nil
}
app := application.Get()
ctx := context.Background()
if app != nil {
ctx = app.Context()
}
if s.backendHost != nil {
return s.backendHost.LoadConfig(ctx)
}
if s.store == nil {
return serverconfig.DefaultConfig(), nil
}
return s.store.Load(ctx)
}
// SaveUserConfig 用于处理与 SaveUserConfig 相关的逻辑。
func (s *ProxyService) SaveUserConfig(cfg UserConfig) error {
if s == nil {
return nil
}
app := application.Get()
ctx := context.Background()
if app != nil {
ctx = app.Context()
}
var (
normalized UserConfig
err error
)
if s.backendHost != nil {
normalized, err = s.backendHost.SaveConfig(ctx, cfg)
} else if s.store != nil {
normalized, err = s.store.Save(ctx, cfg)
} else {
return nil
}
if err != nil {
return err
}
s.emitUserConfigChanged(normalized)
return nil
}
func (s *ProxyService) emitUserConfigChanged(cfg UserConfig) {
app := application.Get()
if app == nil {
return
}
app.Event.Emit("user-config:changed", cfg)
}
// resolveUserConfigPath 用于处理与 resolveUserConfigPath 相关的逻辑。
func resolveUserConfigPath() string {
return appdata.ConfigFilePath()
}
// resolveLogsRootPath 用于处理与 resolveLogsRootPath 相关的逻辑。
func resolveLogsRootPath() string {
return appdata.LogsRootPath()
}
// ResolveLogsRootPath 用于处理与 ResolveLogsRootPath 相关的逻辑。
func ResolveLogsRootPath() string {
return resolveLogsRootPath()
}
// ResolveSettingsRootPath 用于处理与 ResolveSettingsRootPath 相关的逻辑。
func ResolveSettingsRootPath() string {
return appdata.RootDir()
}