mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 12:38:12 +00:00
LibGUI: Allow navigating into symlinked directories in FilePicker
If you double-click on a symlink to a directory while browsing with a FilePicker, you most likely want to open the directory the symlink points to, not open the symlink itself. So let's do that. :^)
This commit is contained in:
parent
bcd05e199b
commit
8db4819271
3 changed files with 12 additions and 1 deletions
|
@ -164,6 +164,16 @@ void FileSystemModel::Node::reify_if_needed()
|
|||
fetch_data(full_path(), parent == nullptr || parent->m_parent_of_root);
|
||||
}
|
||||
|
||||
bool FileSystemModel::Node::is_symlink_to_directory() const
|
||||
{
|
||||
if (!S_ISLNK(mode))
|
||||
return false;
|
||||
struct stat st;
|
||||
if (lstat(symlink_target.characters(), &st) < 0)
|
||||
return false;
|
||||
return S_ISDIR(st.st_mode);
|
||||
}
|
||||
|
||||
String FileSystemModel::Node::full_path() const
|
||||
{
|
||||
Vector<String, 32> lineage;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue