Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Non existing folders appear on top #189

Closed
lesauxvi opened this issue Jul 8, 2024 · 9 comments
Closed

Non existing folders appear on top #189

lesauxvi opened this issue Jul 8, 2024 · 9 comments

Comments

@lesauxvi
Copy link

lesauxvi commented Jul 8, 2024

I've an issue that appear only on Windows apparently (I've not seen this issue on MacOS, nor Linux) where non existing folders appear on top (see Figure below). In this example, there are three folders (two start with !!!!!, the other one with $).

Capture d’écran 2024-07-08 à 10 50 59

If I double click on one of these folder, I get an empty directory.

The configuration I use is here:

IGFD::FileDialogConfig config;
config.path = workspace.default_directory(); // specific to my application
constexpr auto IGFD_FLAGS = ImGuiFileDialogFlags_Modal | ImGuiFileDialogFlags_DontShowHiddenFiles | ImGuiFileDialogFlags_NaturalSorting;
config.flags = IGFD_FLAGS;
config.countSelectionMax = 0;
const auto filters = "Infrared files (*.irb,*.nvf,*.ptw){.irb,.nvf,.ptw}";
ImGuiFileDialog::Instance()->OpenDialog("import_ir_files_dialog", ICON_MS_WEB_STORIES "  Select the infrared files to import", filters, config);

and my configuration file is here. I had to add .txt to be able to upload the file. This appear on local drives, as well as on network drives.

Are you aware of this issue?

@aiekick
Copy link
Owner

aiekick commented Jul 8, 2024

Hello,

thanks for the report.

not im not aware about this bug, and its very weird. never got a similar bug..

are you sure these directories are not in your fs ? maybe hidden or something ?

the recycle bin is a normal hidden folder

you have a flag for hide "hidden files on fs"

@lesauxvi
Copy link
Author

lesauxvi commented Jul 8, 2024

That is also what I looked at first, but I already use the ImGuiFileDialogFlags_DontShowHiddenFiles flag.

If I display the hidden folder in the windows explorer, then the recycle bin folder appear, not the folders that start with !!!!!.

@aiekick
Copy link
Owner

aiekick commented Jul 8, 2024

I have checked on my side, and cant found a bug.
Can you debug IGFD, put a breakpoint in the ScanDirectory func of the fs interface you are using.
check files by file. the goal is to see if your fs list theses files or not ?

for me these dir must exist on your fs, if not i not see how its possible to enter in them with IGFD.
since the existence of the path is tested before enter it even they are finally empty.

maybe the fs can list directories you have difficulties to see in explorer according to any blocking rules, by ex from your organization

@lesauxvi
Copy link
Author

lesauxvi commented Jul 9, 2024

I used the debug mode and placed a breakpoint where you suggest me to do. Some non existing files are seen (see below for one example). They do not appear on the Windows explorer, even with the "show hidden files and folders" checked). That is really weird.

Capture d’écran 2024-07-09 à 19 21 00 Capture d’écran 2024-07-09 à 19 22 11

I will check with my IT tomorrow if they are aware of these hidden files (I'm not administrator in this windows machine, so I do not master everything).

I'm coming back to you tomorrow.

@aiekick
Copy link
Owner

aiekick commented Jul 9, 2024

Yes its very weird

One time i guess could be some buffer overflow so with a weird name, but here the ext is good.
Btw since your fs directly list theses files so they are existing somewhere.

I know ntfs is a powerful fs who can hide files in many ways. so maybe a lost tmp file, or a virus who saved datas in theses files and have a way for hide them from your file explorer.

yes your admins can have an idea or inspect them.

@lesauxvi
Copy link
Author

I did some experiments this morning on several Windows machine that can be classified into two categories: machines configured by our IT and personal laptops. It appears that the issue appears only on the machines managed by our IT.

After a discussion with IT guys, these strange folders and files are actually created by our antivirus software in order to catch malicious softwares (see here for a more detailed explanation).

The syntax of these hidden files/folders seem to be imposed: 5 ! followed by 10 digits (and sometimes an extension). I suggest two solutions:

  1. add a small paragraph somewhere to inform the users that this may happen depending on the machine configuration
  2. add an exception rule in the ScanDirectory function to avoid the files that respect the naming convention (5 ! followed by 10 digits)

What do you think?

PS : the problem occurs using the std::filesystem interface, as well as dirent.

@aiekick
Copy link
Owner

aiekick commented Jul 10, 2024

PS : the problem occurs using the std::filesystem interface, as well as dirent.

To be clear, this is not a bug or a problem, IGFD does what it is supposed to do : list files from the file system

In a second time if a user want avoid the listing of some patterns due to his side configuration, is an another thing.

So now you can use regex for maybe avoid these files if you have a pattern who correpond to your files except theses one, or override the fs interface for remove some specific files

fyi, the hidden flag, hide dirs starting with a dot

@lesauxvi
Copy link
Author

Yes, IGFD does exactly what it is supposed to do. So, I suggest to close this issue as it is not related to the library.

The best thing for my case is what you suggest (or if I'm lazy just to inform the user of the "issue").

Would it make sense to add a custom character plus a flag, such as the hidden flag? For example, if I dot not want IGFD to list the files or directory that starts with a specific character (! for example ;-)), then I can by activating the flag and defining the character in the config header file. This is very specific, so I would totally understand if it is not the purpose of the library to do such a thing.

Anyway, thank you for your time, I really appreciate.

@aiekick
Copy link
Owner

aiekick commented Jul 10, 2024

i think i can add something for filter more the listing, more specific for all dirs or per dir.

Because with regex you have a way for filter dir or file to show, but you dont have pattern to ignore and that can be some specific files or dirs like in your case.

Will think about it.

for now yes we can close

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants