mirror of
https://github.com/yeongpin/cursor-free-vip.git
synced 2025-08-02 20:47:35 +08:00
feat: Add support for custom Cursor installation paths on Windows
- Modify base_path detection to use custom paths from config - Replace forward slashes with backslashes in Windows path definition
This commit is contained in:
parent
ea44218a8a
commit
80aab8741f
@ -159,6 +159,14 @@ def get_cursor_machine_id_path(translator=None) -> str:
|
|||||||
def get_workbench_cursor_path(translator=None) -> str:
|
def get_workbench_cursor_path(translator=None) -> str:
|
||||||
"""Get Cursor workbench.desktop.main.js path"""
|
"""Get Cursor workbench.desktop.main.js path"""
|
||||||
system = platform.system()
|
system = platform.system()
|
||||||
|
|
||||||
|
# Read configuration
|
||||||
|
config_dir = os.path.join(get_user_documents_path(), ".cursor-free-vip")
|
||||||
|
config_file = os.path.join(config_dir, "config.ini")
|
||||||
|
config = configparser.ConfigParser()
|
||||||
|
|
||||||
|
if os.path.exists(config_file):
|
||||||
|
config.read(config_file)
|
||||||
|
|
||||||
paths_map = {
|
paths_map = {
|
||||||
"Darwin": { # macOS
|
"Darwin": { # macOS
|
||||||
@ -166,8 +174,7 @@ def get_workbench_cursor_path(translator=None) -> str:
|
|||||||
"main": "out/vs/workbench/workbench.desktop.main.js"
|
"main": "out/vs/workbench/workbench.desktop.main.js"
|
||||||
},
|
},
|
||||||
"Windows": {
|
"Windows": {
|
||||||
"base": os.path.join(os.getenv("LOCALAPPDATA", ""), "Programs", "Cursor", "resources", "app"),
|
"main": "out\\vs\\workbench\\workbench.desktop.main.js"
|
||||||
"main": "out/vs/workbench/workbench.desktop.main.js"
|
|
||||||
},
|
},
|
||||||
"Linux": {
|
"Linux": {
|
||||||
"bases": ["/opt/Cursor/resources/app", "/usr/share/cursor/resources/app", "/usr/lib/cursor/app/"],
|
"bases": ["/opt/Cursor/resources/app", "/usr/share/cursor/resources/app", "/usr/lib/cursor/app/"],
|
||||||
@ -185,7 +192,11 @@ def get_workbench_cursor_path(translator=None) -> str:
|
|||||||
return main_path
|
return main_path
|
||||||
raise OSError(translator.get('reset.linux_path_not_found') if translator else "在 Linux 系统上未找到 Cursor 安装路径")
|
raise OSError(translator.get('reset.linux_path_not_found') if translator else "在 Linux 系统上未找到 Cursor 安装路径")
|
||||||
|
|
||||||
base_path = paths_map[system]["base"]
|
if system == "Windows":
|
||||||
|
base_path = config.get('WindowsPaths', 'cursor_path')
|
||||||
|
else:
|
||||||
|
base_path = paths_map[system]["base"]
|
||||||
|
|
||||||
main_path = os.path.join(base_path, paths_map[system]["main"])
|
main_path = os.path.join(base_path, paths_map[system]["main"])
|
||||||
|
|
||||||
if not os.path.exists(main_path):
|
if not os.path.exists(main_path):
|
||||||
|
Loading…
x
Reference in New Issue
Block a user