antonmedv / walk

Terminal file manager
MIT License
3.22k stars 89 forks source link

Don't panic if reading dir is not allowed (macOS) #76

Closed m5lk3n closed 1 year ago

m5lk3n commented 1 year ago

On macOS, when entering a directory for which the user has no (reading) permission, this fix avoids a panic, e.g. for .Trash:

Caught panic:

open /Users/$USER/.Trash: operation not permitted

"No files" is displayed instead.

antonmedv commented 1 year ago

"No files" is displayed instead.

lets show "open operation not permitted" insteasd

m5lk3n commented 1 year ago

I tried to make it a bit more generic with the 2nd commit. Now, a "Not permitted" error message is appended to the location bar in folders that can't be viewed. The message disappears on folder exit again. This way, it doesn't interfere with the current app behavior and layout. It also leaves the door open for other errors like timeout. Last, it's inline with e.g. native file explorers that show an error message but just don't list files. Hope that's ok.