mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 19:17:44 +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:
parent
f8d643284e
commit
509e39ac00
2 changed files with 6 additions and 5 deletions
|
@ -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(¤t_view());
|
||||
model().set_root_path(path);
|
||||
model().set_root_path(real_path);
|
||||
}
|
||||
|
||||
void DirectoryView::set_status_message(const StringView& message)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue