mirror of
https://github.com/yeongpin/cursor-free-vip.git
synced 2025-08-02 20:47:35 +08:00
Enhance Linux path detection for Cursor AppImage installations
This commit is contained in:
parent
ea44218a8a
commit
f888b8c90c
@ -8,6 +8,7 @@ import sqlite3
|
|||||||
import platform
|
import platform
|
||||||
import re
|
import re
|
||||||
import tempfile
|
import tempfile
|
||||||
|
import glob
|
||||||
from colorama import Fore, Style, init
|
from colorama import Fore, Style, init
|
||||||
from typing import Tuple
|
from typing import Tuple
|
||||||
import configparser
|
import configparser
|
||||||
@ -49,6 +50,17 @@ def get_cursor_paths(translator=None) -> Tuple[str, str]:
|
|||||||
"Linux": ["/opt/Cursor/resources/app", "/usr/share/cursor/resources/app", os.path.expanduser("~/.local/share/cursor/resources/app"), "/usr/lib/cursor/app/"]
|
"Linux": ["/opt/Cursor/resources/app", "/usr/share/cursor/resources/app", os.path.expanduser("~/.local/share/cursor/resources/app"), "/usr/lib/cursor/app/"]
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if system == "Linux":
|
||||||
|
# Look for any AppImage mounts of Cursor
|
||||||
|
appimage_paths = glob.glob("/tmp/.mount_Cursor*/resources/app")
|
||||||
|
# Look for extracted AppImage directories
|
||||||
|
extracted_paths = glob.glob(os.path.expanduser("~/squashfs-root/resources/app"))
|
||||||
|
|
||||||
|
# Add any found paths to the Linux paths list
|
||||||
|
default_paths["Linux"].extend(appimage_paths)
|
||||||
|
default_paths["Linux"].extend(extracted_paths)
|
||||||
|
|
||||||
|
|
||||||
# If config doesn't exist, create it with default paths
|
# If config doesn't exist, create it with default paths
|
||||||
if not os.path.exists(config_file):
|
if not os.path.exists(config_file):
|
||||||
for section in ['MacPaths', 'WindowsPaths', 'LinuxPaths']:
|
for section in ['MacPaths', 'WindowsPaths', 'LinuxPaths']:
|
||||||
@ -175,15 +187,35 @@ def get_workbench_cursor_path(translator=None) -> str:
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if system == "Linux":
|
||||||
|
# Add original AppImage paths
|
||||||
|
appimage_bases = glob.glob("/tmp/.mount_Cursor*/resources/app")
|
||||||
|
extracted_bases = glob.glob(os.path.expanduser("~/squashfs-root/resources/app"))
|
||||||
|
|
||||||
|
# Add correct path for AppImage structure
|
||||||
|
appimage_usr_paths = glob.glob("/tmp/.mount_Cursor*/usr/share/cursor/resources/app")
|
||||||
|
|
||||||
|
# Also try without the "app" directory if it doesn't exist
|
||||||
|
appimage_usr_resources = glob.glob("/tmp/.mount_Cursor*/usr/share/cursor/resources")
|
||||||
|
|
||||||
|
# Add debug output
|
||||||
|
for mount in glob.glob("/tmp/.mount_Cursor*"):
|
||||||
|
print(f"{Fore.CYAN}{EMOJI['INFO']} Found AppImage mount: {mount}{Style.RESET_ALL}")
|
||||||
|
|
||||||
|
paths_map["Linux"]["bases"].extend(appimage_bases)
|
||||||
|
paths_map["Linux"]["bases"].extend(extracted_bases)
|
||||||
|
paths_map["Linux"]["bases"].extend(appimage_usr_paths)
|
||||||
|
paths_map["Linux"]["bases"].extend(appimage_usr_resources)
|
||||||
|
|
||||||
if system not in paths_map:
|
if system not in paths_map:
|
||||||
raise OSError(translator.get('reset.unsupported_os', system=system) if translator else f"不支持的操作系统: {system}")
|
raise OSError(translator.get('reset.unsupported_os', system=system) if translator else f"不支持的操作系统: {system}")
|
||||||
|
|
||||||
if system == "Linux":
|
if system == "Linux":
|
||||||
for base in paths_map["Linux"]["bases"]:
|
for base in paths_map["Linux"]["bases"]:
|
||||||
main_path = os.path.join(base, paths_map["Linux"]["main"])
|
main_path = os.path.join(base, paths_map["Linux"]["main"])
|
||||||
|
print(f"{Fore.CYAN}{EMOJI['INFO']} Checking path: {main_path}{Style.RESET_ALL}")
|
||||||
if os.path.exists(main_path):
|
if os.path.exists(main_path):
|
||||||
return main_path
|
return main_path
|
||||||
raise OSError(translator.get('reset.linux_path_not_found') if translator else "在 Linux 系统上未找到 Cursor 安装路径")
|
|
||||||
|
|
||||||
base_path = paths_map[system]["base"]
|
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"])
|
||||||
|
Loading…
x
Reference in New Issue
Block a user