дȫÏîĿÉó²éÎÊÌⲢ·¢²¼ v1.1.9
¸ÄÓñ¾»ú¶ÀÁ¢ CA£¬»ָ´ CLI TLS УÑ飬±£»¤ƾ¾ÝÓëÅäÖò¢·¢±£´档 д Cursor Êý¾ݡ¢»Ự·¾¶¡¢´úÀíÉúÃüÖÜÆڡ¢ģÐÍÇëÇóÓë Skills Îļþ²Ù×÷¡£ Ϊ¶ÀÁ¢ Tab ·þÎñÔö¼ӿͻ§¶˼øȨ£¬Éý¼¶ÒÀÀµÓ빤¾ßÁ´£¬ÍêÉƷ¢²¼ԪÐÅϢͬ²½¡£ Ñé֤£ºÁ½¸ö Go ģ¿éµIJâÊÔ/vet¡¢¹ؼüģ¿é race¡¢ǰ¶˲âÊÔ/Éú²ú¹¹½¨/Éó¼ơ¢ Go ¿ɴï©¶´ɨÃèÓë macOS/Linux ¿ÉÐÐģ¿齻²æ±àÒë¾ùͨ¹ý¡£ Windows ¸ôÀëÆô¶¯ͨ¹ý£»δÍê³ɵĵã»÷ðÑ̺ÍԭÉúƽ̨Ñé֤¼ûÉó²鱨¸档
This commit is contained in:
@@ -179,8 +179,16 @@ func DeleteProjectRecord(projectPath string) error {
|
||||
return fmt.Errorf("未找到 Cursor 用户数据目录: %s", userDir)
|
||||
}
|
||||
|
||||
storageRemoved, storageErr := removeWorkspaceStorageEntries(userDir, projectPath)
|
||||
return deleteProjectRecords(userDir, projectPath)
|
||||
}
|
||||
|
||||
func deleteProjectRecords(userDir, projectPath string) error {
|
||||
// Never delete chat data before confirming that the recent-list database can be updated.
|
||||
entryRemoved, entryErr := removeRecentlyOpenedEntry(userDir, projectPath)
|
||||
if entryErr != nil {
|
||||
return entryErr
|
||||
}
|
||||
storageRemoved, storageErr := removeWorkspaceStorageEntries(userDir, projectPath)
|
||||
if storageErr != nil || entryErr != nil {
|
||||
return fmt.Errorf("删除不完整(workspaceStorage: %d 处, %v;最近打开列表: %d 处, %v)",
|
||||
storageRemoved, storageErr, entryRemoved, entryErr)
|
||||
@@ -255,32 +263,40 @@ func removeRecentlyOpenedEntry(userDir string, projectPath string) (int, error)
|
||||
}
|
||||
return 0, fmt.Errorf("读取最近打开列表失败: %w", err)
|
||||
}
|
||||
var payload struct {
|
||||
Entries []struct {
|
||||
FolderURI string `json:"folderUri"`
|
||||
} `json:"entries"`
|
||||
}
|
||||
var payload map[string]json.RawMessage
|
||||
if err := json.Unmarshal([]byte(raw), &payload); err != nil {
|
||||
return 0, fmt.Errorf("解析最近打开列表失败: %w", err)
|
||||
}
|
||||
kept := make([]struct {
|
||||
FolderURI string `json:"folderUri"`
|
||||
}, 0, len(payload.Entries))
|
||||
var entries []json.RawMessage
|
||||
if err := json.Unmarshal(payload["entries"], &entries); err != nil {
|
||||
return 0, err
|
||||
}
|
||||
kept := make([]json.RawMessage, 0, len(entries))
|
||||
removed := 0
|
||||
for _, item := range payload.Entries {
|
||||
for _, entry := range entries {
|
||||
var item struct {
|
||||
FolderURI string `json:"folderUri"`
|
||||
}
|
||||
if err := json.Unmarshal(entry, &item); err != nil {
|
||||
return 0, err
|
||||
}
|
||||
path := projectPathFromURI(item.FolderURI)
|
||||
if path != "" && samePath(filepath.Clean(path), projectPath) {
|
||||
removed++
|
||||
continue
|
||||
}
|
||||
kept = append(kept, item)
|
||||
kept = append(kept, entry)
|
||||
}
|
||||
if removed == 0 {
|
||||
return 0, nil
|
||||
}
|
||||
updated, err := json.Marshal(map[string]any{"entries": kept})
|
||||
payload["entries"], err = json.Marshal(kept)
|
||||
if err != nil {
|
||||
return 0, fmt.Errorf("序列化最近打开列表失败: %w", err)
|
||||
return 0, err
|
||||
}
|
||||
updated, err := json.Marshal(payload)
|
||||
if err != nil {
|
||||
return 0, err
|
||||
}
|
||||
if _, err := db.Exec(
|
||||
"UPDATE ItemTable SET value = ? WHERE key = 'history.recentlyOpenedPathsList'",
|
||||
|
||||
Reference in New Issue
Block a user