1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-10 07:07:36 +00:00

FileManager: Don't show "." and ".." in directory views.

This commit is contained in:
Andreas Kling 2019-03-24 12:27:02 +01:00
parent f18ed4f633
commit 900a3966e2
2 changed files with 3 additions and 1 deletions

View file

@ -227,6 +227,8 @@ void DirectoryModel::update()
while (auto* de = readdir(dirp)) {
Entry entry;
entry.name = de->d_name;
if (entry.name == "." || entry.name == "..")
continue;
struct stat st;
int rc = lstat(String::format("%s/%s", m_path.characters(), de->d_name).characters(), &st);
if (rc < 0) {

View file

@ -12,7 +12,7 @@ DirectoryView::DirectoryView(GWidget* parent)
m_table_view = new GTableView(this);
m_table_view->set_model(GSortingProxyModel::create(m_model.copy_ref()));
model().set_key_column_and_sort_order(DirectoryModel::Column::Name, GSortOrder::Ascending);
m_table_view->model()->set_key_column_and_sort_order(DirectoryModel::Column::Name, GSortOrder::Ascending);
m_item_view->set_model_column(DirectoryModel::Column::Name);