Skip to content

Commit b0abfd2

Browse files
committed
feat: 添加打开目录功能
1 parent 2057dde commit b0abfd2

2 files changed

Lines changed: 18 additions & 0 deletions

File tree

windsurf_mac.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,7 @@ def setup_ui(self):
114114
ttk.Button(btn_frame, text="保存当前账号", command=self.save_current_profile).pack(side=tk.LEFT, padx=5)
115115
ttk.Button(btn_frame, text="切换账号", command=self.on_switch_click).pack(side=tk.LEFT, padx=5)
116116
ttk.Button(btn_frame, text="删除配置", command=self.delete_profile).pack(side=tk.LEFT, padx=5)
117+
ttk.Button(btn_frame, text="📂 打开目录", command=self.open_profiles_dir).pack(side=tk.LEFT, padx=5)
117118
ttk.Button(btn_frame, text="刷新", command=self.refresh_all).pack(side=tk.RIGHT, padx=5)
118119

119120
# 作者信息水印区域
@@ -233,6 +234,14 @@ def refresh_all(self):
233234
self.refresh_profiles()
234235
self.status_var.set("已刷新")
235236

237+
def open_profiles_dir(self):
238+
"""打开配置文件存储目录"""
239+
# 确保目录存在
240+
os.makedirs(PROFILES_DIR, exist_ok=True)
241+
# Mac 使用 open 命令打开目录
242+
subprocess.run(['open', PROFILES_DIR])
243+
self.status_var.set(f"已打开目录: {PROFILES_DIR}")
244+
236245
# --------------------------------------------------------
237246
# 进程检测 (Mac版本)
238247
# --------------------------------------------------------

windsurf_win.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,7 @@ def setup_ui(self):
9292
ttk.Button(btn_frame, text="保存当前账号", command=self.save_current_profile).pack(side=tk.LEFT, padx=5)
9393
ttk.Button(btn_frame, text="切换账号", command=self.on_switch_click).pack(side=tk.LEFT, padx=5)
9494
ttk.Button(btn_frame, text="删除配置", command=self.delete_profile).pack(side=tk.LEFT, padx=5)
95+
ttk.Button(btn_frame, text="📂 打开目录", command=self.open_profiles_dir).pack(side=tk.LEFT, padx=5)
9596
ttk.Button(btn_frame, text="刷新", command=self.refresh_all).pack(side=tk.RIGHT, padx=5)
9697

9798
# 作者信息水印区域
@@ -200,6 +201,14 @@ def refresh_all(self):
200201
self.refresh_profiles()
201202
self.status_var.set("已刷新")
202203

204+
def open_profiles_dir(self):
205+
"""打开配置文件存储目录"""
206+
# 确保目录存在
207+
os.makedirs(PROFILES_DIR, exist_ok=True)
208+
# Windows 使用 explorer 打开目录
209+
os.startfile(PROFILES_DIR)
210+
self.status_var.set(f"已打开目录: {PROFILES_DIR}")
211+
203212
def is_windsurf_running(self):
204213
"""检查Windsurf是否正在运行"""
205214
try:

0 commit comments

Comments
 (0)