mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 10:28:10 +00:00
FileManager: Graceful handling of access errors
A neat error message is displayed when failing to open a directory!
This commit is contained in:
parent
451b3fa73c
commit
cc424b7b0f
3 changed files with 27 additions and 3 deletions
|
@ -588,6 +588,14 @@ int run_in_windowed_mode(RefPtr<Core::ConfigFile> config, String initial_locatio
|
|||
go_back_action->set_enabled(directory_view.path_history_position() > 0);
|
||||
};
|
||||
|
||||
directory_view.on_error = [&](int, const char* error_string, bool quit) {
|
||||
auto error_message = String::format("Could not read directory: %s", error_string);
|
||||
GUI::MessageBox::show(error_message, "File Manager", GUI::MessageBox::Type::Error);
|
||||
|
||||
if (quit)
|
||||
exit(1);
|
||||
};
|
||||
|
||||
directory_view.on_status_message = [&](const StringView& message) {
|
||||
statusbar.set_text(message);
|
||||
};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue