elementary / files

File browser designed for elementary OS
https://elementary.io
GNU General Public License v3.0
330 stars 78 forks source link

Ignore hidden files for 'this folder is empty' message #1278

Open gamerlv opened 4 years ago

gamerlv commented 4 years ago

Prerequisites

Describe the bug

The empty folder messages does not display if there are files or folders in a directory, even if these are hidden system files. I found this discrepancy when formatting a drive for additional storage and noticed that the NTFS partition displayed a message that it was empty but the EXT partition did not, only a white background.

EXT partitions by default have a hidden folder called 'lost+found' for proper operation of fsck. Most users would/should not care about this folder existing. It would be better to report the folder as being empty when only this folder is present.

To Reproduce

Steps to reproduce the behaviour:

  1. Open gnome-disk-utility
  2. Create two new Disk images
  3. Format both images, One with NTFS and one with EXT4
  4. Mount both images in files using the sidebar
  5. Observe difference, the NTFS disk correctly shows the message 'This folder is empty', the EXT formatted one does not and is just empty.

Expected behaviour

A folder with only hidden files (such as lost+found) should display the 'Empty folder' message.

When the user explicitly has 'Show Hidden Files' enabled the 'Empty folder' message should go away and show the hidden files and system folders.

Caveat

When deleting a folder with (only) hidden files a dialogue may be needed as the user may not be aware that a folder contains hidden files due this message.

I've left the descriptions somewhat general as I immediately see two ways to solve this but am unsure which fits better with the elementary philosophy.

  1. Explicitly exclude a folder named 'lost+found' from the files count
  2. Exclude all hidden files when the 'Show Hidden Files' is unchecked from the files count

Both would fix this, I feel nr2 is more inline with elementarys goals but also has the risk of causing confusion. For example when deleting a folder.

Platform Information

elementary OS 5.1.3 Hera
io.elementary.files 4.4.2 ( 4.4.2+r3786+pkg92~ubuntu5.1.2.1 )

jeremypw commented 4 years ago

I agree the current behaviour is not ideal. I would hesitate to make an exception for a particular hidden file or folder. Maybe when the folder contains no visible files but contains hidden files. the view should show a different message such as "This folder is empty except for hidden files". Perhaps also in these circumstances a "Show Hidden Files" button could be supplied, a bit like the DirectoryNotFound view although that could be tricky as the view needs to retain the behaviour of DirectoryView. Maybe an InfoBar could be used.