nore-dev / fman

TUI File Manager
MIT License
324 stars 20 forks source link

Don't panic on all GetEntries errors #14

Closed Laur1nMartins closed 2 years ago

Laur1nMartins commented 2 years ago

When you go to a folder the app can't access or the file path gets malformed in some way the app just crashes. Looking at the code it seems that this behaviour stems from the Update function on the ListModel. I suggest doing some form of error validation to check if the error is recoverable or indeed a panic must happen.

Due to the fact that this implies some design decisions as to how to handle this from a UI perspective I don't think that doing a pull request with my own solution will be beneficial. If there is anything I can help with let me know.

Laur1nMartins commented 2 years ago

An example: opening fman in any folder and then spamming the left arrow key panics with: stat usr/bin: no such file or directory

nore-dev commented 2 years ago

thank you!

nore-dev commented 2 years ago

@Laur1nMartins it does not panic now but still gives an error. Can you help? read /: is directory

nore-dev commented 2 years ago

using os.Chdir() seems to fix the problem