diff --git a/.env b/.env index 95a7d79..2a2c066 100644 --- a/.env +++ b/.env @@ -1,2 +1,2 @@ -version=1.7.17 -VERSION=1.7.17 +version=1.7.18 +VERSION=1.7.18 diff --git a/CHANGELOG.md b/CHANGELOG.md index 4355127..d5e30ec 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,11 @@ # Change Log +## v1.7.18 +1. Fix: No Write Permission | 修復沒有寫入權限 +2. Fix: Improve Linux path detection and config handling | 修正 linux 路徑和config寫入讀取 +3. Fix: Locale path_no_exist missing | 修正 path_no_exist 語言遺失 +4. Fix: Some Issues | 修復一些問題 + ## v1.7.17 1. Fix: Remove 10 options Totally Reset Cursor | 修復完全重置 Cursor 選項 diff --git a/locales/en.json b/locales/en.json index cf82b25..82bbc21 100644 --- a/locales/en.json +++ b/locales/en.json @@ -103,8 +103,9 @@ "package_not_found": "Package.json Not Found: {path}", "check_version_failed": "Check Version Failed: {error}", "stack_trace": "Stack Trace", - "version_too_low": "Cursor Version Too Low: {version} < 0.45.0" - + "version_too_low": "Cursor Version Too Low: {version} < 0.45.0", + "no_write_permission": "No Write Permission: {path}", + "path_not_found": "Path Not Found: {path}" }, "register": { "title": "Cursor Registration Tool", diff --git a/locales/zh_cn.json b/locales/zh_cn.json index 04eb80e..96f4b25 100644 --- a/locales/zh_cn.json +++ b/locales/zh_cn.json @@ -103,7 +103,9 @@ "package_not_found": "package.json未找到: {path}", "check_version_failed": "检查版本失败: {error}", "stack_trace": "堆栈跟踪", - "version_too_low": "Cursor版本太低: {version} < 0.45.0" + "version_too_low": "Cursor版本太低: {version} < 0.45.0", + "no_write_permission": "没有写入权限: {path}", + "path_not_found": "路径未找到: {path}" }, "register": { "title": "Cursor 注册工具", diff --git a/locales/zh_tw.json b/locales/zh_tw.json index c755b03..6ab8447 100644 --- a/locales/zh_tw.json +++ b/locales/zh_tw.json @@ -101,7 +101,9 @@ "package_not_found": "package.json未找到: {path}", "check_version_failed": "檢查版本失敗: {error}", "stack_trace": "堆疊跟踪", - "version_too_low": "Cursor版本太低: {version} < 0.45.0" + "version_too_low": "Cursor版本太低: {version} < 0.45.0", + "no_write_permission": "沒有寫入權限: {path}", + "path_not_found": "路徑未找到: {path}" }, "register": { diff --git a/logo.py b/logo.py index 7a0faa6..83f4c76 100644 --- a/logo.py +++ b/logo.py @@ -83,7 +83,7 @@ muhammedfurkan plamkatawe """ OTHER_INFO_TEXT = f"""{Fore.YELLOW} Github: https://github.com/yeongpin/cursor-free-vip{Fore.RED} -Press 7 to change language | 按下 7 键切换语言{Style.RESET_ALL}""" +Press 8 to change language | 按下 8 键切换语言{Style.RESET_ALL}""" # center display LOGO and DESCRIPTION CURSOR_LOGO = center_multiline_text(LOGO_TEXT, handle_chinese=False) @@ -98,4 +98,4 @@ def print_logo(): print(CURSOR_OTHER_INFO) if __name__ == "__main__": - print_logo() \ No newline at end of file + print_logo() diff --git a/reset_machine_manual.py b/reset_machine_manual.py index 975c6bd..c9f383f 100644 --- a/reset_machine_manual.py +++ b/reset_machine_manual.py @@ -37,10 +37,41 @@ def get_cursor_paths(translator=None) -> Tuple[str, str]: config_dir = os.path.join(get_user_documents_path(), ".cursor-free-vip") config_file = os.path.join(config_dir, "config.ini") + # Create config directory if it doesn't exist + if not os.path.exists(config_dir): + os.makedirs(config_dir) + + # Default paths for different systems + default_paths = { + "Darwin": "/Applications/Cursor.app/Contents/Resources/app", + "Windows": os.path.join(os.getenv("LOCALAPPDATA", ""), "Programs", "Cursor", "resources", "app"), + "Linux": ["/opt/Cursor/resources/app", "/usr/share/cursor/resources/app", os.path.expanduser("~/.local/share/cursor/resources/app")] + } + + # If config doesn't exist, create it with default paths if not os.path.exists(config_file): - raise OSError(translator.get('reset.config_not_found') if translator else "找不到配置文件") + for section in ['MacPaths', 'WindowsPaths', 'LinuxPaths']: + if not config.has_section(section): + config.add_section(section) - config.read(config_file, encoding='utf-8') # Specify encoding + if system == "Darwin": + config.set('MacPaths', 'cursor_path', default_paths["Darwin"]) + elif system == "Windows": + config.set('WindowsPaths', 'cursor_path', default_paths["Windows"]) + elif system == "Linux": + # For Linux, try to find the first existing path + for path in default_paths["Linux"]: + if os.path.exists(path): + config.set('LinuxPaths', 'cursor_path', path) + break + else: + # If no path exists, use the first one as default + config.set('LinuxPaths', 'cursor_path', default_paths["Linux"][0]) + + with open(config_file, 'w', encoding='utf-8') as f: + config.write(f) + else: + config.read(config_file, encoding='utf-8') # Get path based on system if system == "Darwin": @@ -51,15 +82,26 @@ def get_cursor_paths(translator=None) -> Tuple[str, str]: section = 'LinuxPaths' else: raise OSError(translator.get('reset.unsupported_os', system=system) if translator else f"不支持的操作系统: {system}") - + if not config.has_section(section) or not config.has_option(section, 'cursor_path'): raise OSError(translator.get('reset.path_not_configured') if translator else "未配置 Cursor 路徑") - + base_path = config.get(section, 'cursor_path') + # For Linux, try to find the first existing path if the configured one doesn't exist + if system == "Linux" and not os.path.exists(base_path): + for path in default_paths["Linux"]: + if os.path.exists(path): + base_path = path + # Update config with the found path + config.set(section, 'cursor_path', path) + with open(config_file, 'w', encoding='utf-8') as f: + config.write(f) + break + if not os.path.exists(base_path): raise OSError(translator.get('reset.path_not_found', path=base_path) if translator else f"找不到 Cursor 路徑: {base_path}") - + pkg_path = os.path.join(base_path, "package.json") main_path = os.path.join(base_path, "out/main.js")