1
0
mirror of https://github.com/tw93/Mole.git synced 2026-02-04 15:04:42 +00:00

fix(analyze): improve deletion safety and UI clarity

- Update UI status to 'Moving to Trash...' for clarity
- Use os.Lstat instead of os.Stat to correctly handle broken symlinks during deletion checks
This commit is contained in:
Tw93
2026-01-10 08:51:14 +08:00
parent 273a6b5cf0
commit 7d43e669a8
2 changed files with 3 additions and 3 deletions

View File

@@ -80,8 +80,8 @@ func (e *multiDeleteError) Error() string {
// trashPathWithProgress moves a path to Trash using Finder. // trashPathWithProgress moves a path to Trash using Finder.
// This allows users to recover accidentally deleted files. // This allows users to recover accidentally deleted files.
func trashPathWithProgress(root string, counter *int64) (int64, error) { func trashPathWithProgress(root string, counter *int64) (int64, error) {
// Verify path exists. // Verify path exists (use Lstat to handle broken symlinks).
info, err := os.Stat(root) info, err := os.Lstat(root)
if err != nil { if err != nil {
return 0, err return 0, err
} }

View File

@@ -515,7 +515,7 @@ func (m model) Update(msg tea.Msg) (tea.Model, tea.Cmd) {
if m.deleting && m.deleteCount != nil { if m.deleting && m.deleteCount != nil {
count := atomic.LoadInt64(m.deleteCount) count := atomic.LoadInt64(m.deleteCount)
if count > 0 { if count > 0 {
m.status = fmt.Sprintf("Deleting... %s items removed", formatNumber(count)) m.status = fmt.Sprintf("Moving to Trash... %s items", formatNumber(count))
} }
} }
return m, tickCmd() return m, tickCmd()