diff --git a/0.1.1.md b/0.1.1.md index 769760a..9e4c32d 100644 --- a/0.1.1.md +++ b/0.1.1.md @@ -31,5 +31,5 @@ ### 优化 提交代码 然后优化: -feature: 我已经确认环境中已经安装了 ffmpeg和ffmprobe 日志却显示:场景检测失败 +TODO: 需要优化成一刀切 feature: 在导入时启动异步处理(更好的用户体验) diff --git a/apps/desktop/src-tauri/capabilities/default.json b/apps/desktop/src-tauri/capabilities/default.json index 4cdbf49..368bdd6 100644 --- a/apps/desktop/src-tauri/capabilities/default.json +++ b/apps/desktop/src-tauri/capabilities/default.json @@ -5,6 +5,14 @@ "windows": ["main"], "permissions": [ "core:default", - "opener:default" + "opener:default", + "opener:allow-open-path", + "opener:allow-reveal-item-in-dir", + "fs:default", + "fs:allow-read-file", + "fs:allow-read-dir", + "dialog:default", + "dialog:allow-open", + "dialog:allow-save" ] } diff --git a/apps/desktop/src/pages/ProjectDetails.tsx b/apps/desktop/src/pages/ProjectDetails.tsx index 4360c8b..1ceffe2 100644 --- a/apps/desktop/src/pages/ProjectDetails.tsx +++ b/apps/desktop/src/pages/ProjectDetails.tsx @@ -61,9 +61,32 @@ export const ProjectDetails: React.FC = () => { if (project) { try { const { openPath } = await import('@tauri-apps/plugin-opener'); - await openPath(project.path); + + // 处理 Windows 路径格式,移除 \\?\ 前缀 + let normalizedPath = project.path; + if (normalizedPath.startsWith('\\\\?\\')) { + normalizedPath = normalizedPath.substring(4); + } + + console.log('尝试打开路径:', normalizedPath); + await openPath(normalizedPath); } catch (error) { console.error('打开文件夹失败:', error); + + // 如果 openPath 失败,尝试使用 revealItemInDir + try { + const { revealItemInDir } = await import('@tauri-apps/plugin-opener'); + let normalizedPath = project.path; + if (normalizedPath.startsWith('\\\\?\\')) { + normalizedPath = normalizedPath.substring(4); + } + console.log('尝试使用 revealItemInDir 打开:', normalizedPath); + await revealItemInDir(normalizedPath); + } catch (fallbackError) { + console.error('备用方法也失败:', fallbackError); + // 可以在这里显示用户友好的错误提示 + alert('无法打开文件夹,请检查路径是否存在'); + } } } };