@@ -395,6 +395,35 @@ function formatUnitType(unitType: SaveUnit['unit_type']) {
395395 return unitType ;
396396 }
397397}
398+
399+ async function handleOpenPath(e : MouseEvent , path : string , unit ? : SaveUnit ) {
400+ if (! path || ! path .trim ()) return ;
401+
402+ const ctrl = (e && (e as MouseEvent ).ctrlKey ) || (e && (e as MouseEvent ).metaKey );
403+ if (ctrl && unit && unit .unit_type === ' File' ) {
404+ const normalized = path .replace (/ \\ / g , ' /' );
405+ const idx = normalized .lastIndexOf (' /' );
406+ const parent = idx > - 1 ? normalized .substring (0 , idx ) : normalized ;
407+ try {
408+ const result = await commands .openFileOrFolder (parent );
409+ if (result .status === ' error' ) {
410+ showError ({ message: $t (' error.open_url_failed' ) });
411+ }
412+ } catch {
413+ showError ({ message: $t (' error.open_url_failed' ) });
414+ }
415+ return ;
416+ }
417+
418+ try {
419+ const result = await commands .openFileOrFolder (path );
420+ if (result .status === ' error' ) {
421+ showError ({ message: $t (' error.open_url_failed' ) });
422+ }
423+ } catch {
424+ showError ({ message: $t (' error.open_url_failed' ) });
425+ }
426+ }
398427 </script >
399428
400429<template >
@@ -539,14 +568,23 @@ function formatUnitType(unitType: SaveUnit['unit_type']) {
539568 }}</el-tag >
540569 </div >
541570 <div class =" unit-card-actions" >
542- <el-button
543- text
544- size =" small"
545- :disabled =" !getDevicePath(unit, selectedDeviceId)"
546- @click =" openPath(getDevicePath(unit, selectedDeviceId))"
571+ <el-tooltip
572+ :content ="
573+ unit.unit_type === 'File'
574+ ? $t('save_location_drawer.open_ctrl_hint')
575+ : $t('save_location_drawer.open')
576+ "
577+ placement =" top"
547578 >
548- {{ $t('save_location_drawer.open') }}
549- </el-button >
579+ <el-button
580+ text
581+ size =" small"
582+ :disabled =" !getDevicePath(unit, selectedDeviceId)"
583+ @click =" (e) => handleOpenPath(e, getDevicePath(unit, selectedDeviceId), unit)"
584+ >
585+ {{ $t('save_location_drawer.open') }}
586+ </el-button >
587+ </el-tooltip >
550588 <el-button text size =" small" @click =" chooseUnitPath(unit)" >
551589 {{ $t('save_location_drawer.pick_path') }}
552590 </el-button >
@@ -624,14 +662,23 @@ function formatUnitType(unitType: SaveUnit['unit_type']) {
624662 <el-button text size =" small" @click =" chooseUnitPath(unit)" >
625663 {{ $t('save_location_drawer.pick_path') }}
626664 </el-button >
627- <el-button
628- text
629- size =" small"
630- :disabled =" !getDevicePath(unit, selectedDeviceId)"
631- @click =" openPath(getDevicePath(unit, selectedDeviceId))"
665+ <el-tooltip
666+ :content ="
667+ unit.unit_type === 'File'
668+ ? $t('save_location_drawer.open_ctrl_hint')
669+ : $t('save_location_drawer.open')
670+ "
671+ placement =" top"
632672 >
633- {{ $t('save_location_drawer.open') }}
634- </el-button >
673+ <el-button
674+ text
675+ size =" small"
676+ :disabled =" !getDevicePath(unit, selectedDeviceId)"
677+ @click =" (e) => handleOpenPath(e, getDevicePath(unit, selectedDeviceId), unit)"
678+ >
679+ {{ $t('save_location_drawer.open') }}
680+ </el-button >
681+ </el-tooltip >
635682 <el-button type =" primary" size =" small" plain @click =" setUnitEnabled(unit, true)" >
636683 {{ $t('save_location_drawer.restore') }}
637684 </el-button >
0 commit comments