From 6d02403e066b1300235bf00c7cb1b686573d4254 Mon Sep 17 00:00:00 2001 From: Sam Atkins Date: Sat, 24 Jun 2023 13:08:00 +0100 Subject: [PATCH] FileManager: Restore inline message behavior for inaccessible dirs Print the correct error from Core::System::chdir() instead of errno, and display the error in the DirectoryView instead of continuing to show the previous location's contents. This regressed in 1dc3ba6ed5bfbb0055d9335a32f580a73f3ab254. --- Userland/Applications/FileManager/DirectoryView.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Userland/Applications/FileManager/DirectoryView.cpp b/Userland/Applications/FileManager/DirectoryView.cpp index 17f6b2999f..2c848c7910 100644 --- a/Userland/Applications/FileManager/DirectoryView.cpp +++ b/Userland/Applications/FileManager/DirectoryView.cpp @@ -408,9 +408,9 @@ bool DirectoryView::open(DeprecatedString const& path) return false; auto real_path = error_or_real_path.release_value(); - if (Core::System::chdir(real_path).is_error()) { - perror("chdir"); - return false; + if (auto result = Core::System::chdir(real_path); result.is_error()) { + dbgln("Failed to open '{}': {}", real_path, result.error()); + warnln("Failed to open '{}': {}", real_path, result.error()); } if (model().root_path() == real_path.to_deprecated_string()) {