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 1dc3ba6ed5.
This commit is contained in:
Sam Atkins 2023-06-24 13:08:00 +01:00 committed by Sam Atkins
parent 477a96820d
commit 6d02403e06

View file

@ -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()) {