* 读取当前文件管理器窗口的文件夹路径 * - macOS: 检查 Finder 并通过 osascript 获取路径 * - Windows: 检查 Explorer 并通过 COM 或桌面路径获取 * - Linux: 不支持 * @returns 文件夹路径字符串 * @throws 当前窗口不是文件管理器、无法读取路径、或平台不支持时抛出 Error
()
| 141 | * @throws 当前窗口不是文件管理器、无法读取路径、或平台不支持时抛出 Error |
| 142 | */ |
| 143 | private async readCurrentFolderPath(): Promise<string> { |
| 144 | const currentPlatform = os.platform() |
| 145 | |
| 146 | if (currentPlatform === 'darwin') { |
| 147 | return this.readCurrentFolderPathMac() |
| 148 | } else if (currentPlatform === 'win32') { |
| 149 | return this.readCurrentFolderPathWindows() |
| 150 | } else { |
| 151 | throw new Error('该平台不支持') |
| 152 | } |
| 153 | } |
| 154 | |
| 155 | /** |
| 156 | * 读取当前浏览器窗口的 URL |
no test coverage detected