mirror of
https://github.com/algerkong/AlgerMusicPlayer.git
synced 2026-04-16 07:50:50 +08:00
Merge branch 'dev_electron' into dev_i18n
This commit is contained in:
@@ -60,13 +60,22 @@ export function initializeFileManager() {
|
||||
// 通用的打开目录处理
|
||||
ipcMain.on('open-directory', (_, filePath) => {
|
||||
try {
|
||||
if (fs.statSync(filePath).isDirectory()) {
|
||||
shell.openPath(filePath);
|
||||
// 验证文件路径
|
||||
if (!filePath) {
|
||||
console.error('无效的文件路径: 路径为空');
|
||||
return;
|
||||
}
|
||||
|
||||
// 统一处理路径分隔符
|
||||
const normalizedPath = path.normalize(filePath);
|
||||
|
||||
if (fs.statSync(normalizedPath).isDirectory()) {
|
||||
shell.openPath(normalizedPath);
|
||||
} else {
|
||||
shell.showItemInFolder(filePath);
|
||||
shell.showItemInFolder(normalizedPath);
|
||||
}
|
||||
} catch (error) {
|
||||
console.error('Error opening path:', error);
|
||||
console.error('打开路径失败:', error);
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user