1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 03:37:34 +00:00

FileManager: Make DirectoryView open links in their real directory

Previously it was possible to open a link like /home/anon/Desktop/Home,
leading to a folder with the same name. Now it correctly opens its real
path, which is /home/anon

FileManager: Use Core::File::real_path_for to get real path of links
This commit is contained in:
DragonAlex98 2021-01-24 00:43:33 +01:00 committed by Andreas Kling
parent f8d643284e
commit 509e39ac00
2 changed files with 6 additions and 5 deletions

View file

@ -29,6 +29,7 @@
#include <AK/LexicalPath.h>
#include <AK/NumberFormat.h>
#include <AK/StringBuilder.h>
#include <LibCore/File.h>
#include <LibCore/MimeData.h>
#include <LibCore/StandardPaths.h>
#include <LibGUI/FileIconProvider.h>
@ -349,13 +350,15 @@ void DirectoryView::add_path_to_history(const StringView& path)
void DirectoryView::open(const StringView& path)
{
if (model().root_path() == path) {
auto real_path = Core::File::real_path_for(path);
if (model().root_path() == real_path) {
model().update();
return;
}
set_active_widget(&current_view());
model().set_root_path(path);
model().set_root_path(real_path);
}
void DirectoryView::set_status_message(const StringView& message)