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

Clarify how the API deals with hidden files #155

Open
tomayac opened this issue Feb 17, 2020 · 5 comments
Open

Clarify how the API deals with hidden files #155

tomayac opened this issue Feb 17, 2020 · 5 comments
Milestone

Comments

@tomayac
Copy link
Contributor

tomayac commented Feb 17, 2020

Should the API be aware of hidden files? Something like .gitignore may well be suitable for a Web-based IDE to display. FWIW, the macOS file picker preview doesn't show hidden files (even if I have decided on a system level to show them), but hidden files are then included in the directory listing (notice the missing .gitignore in the file picker):

Screen Shot 2020-02-17 at 14 55 12

Should a File object have a hidden flag, since the UNIX convention to prefix hidden files with a . doesn't exist on Windows for example?

@veith
Copy link

veith commented Feb 17, 2020

Hidden files are part of the filesystem and should stay included in the directory listing, they are just hidden for the user.
Files like .gitignore, .editorconfig, .npmrc,... are also useful and sometimes needed in a Web-based IDE .

The hidden flag seems to be very useful when you present files to the user,...

+1 for the hidden flag idea

@tomayac
Copy link
Contributor Author

tomayac commented Feb 17, 2020

(You can play with this code at https://github.com/GoogleChromeLabs/browser-nativefs#live-demo.)

@mkruisselbrink
Copy link
Contributor

Good question, yes, I agree that hidden files should be exposed by the API, but we probably do indeed want to somehow expose the "hidden" flag to the web. This kind feels like part of the bigger question of what other metadata about files we should expose (although "hidden" is perhaps different since it not only applies to files but also to directories).

Related question is if it should be possible to create new hidden files/directories? On platforms where the "hidden" state of a file is merely the fact that the name starts with a "." it is effectively already possible to do so, but on windows it is not currently possible. Should it be possible on windows as well?

@mkruisselbrink mkruisselbrink added this to the V2 milestone Apr 9, 2020
@a-sully
Copy link
Collaborator

a-sully commented Jan 9, 2023

Seems reasonable to support this on Windows, as well. We could expose an isHidden attribute as part of the file metadata (proposed here whatwg/fs#12) and add a new flag to getFileHandle(), though we'd
have to specify how that behaves with the name parameter

Most OS file pickers don't show hidden files and AFAIK there's no way to configure that programmatically (please correct me if I'm wrong)

I have some reservations about making a given file hidden, since from the perspective of the user it could appear as if the file is removed (especially if the site does not have access to the parent). Perhaps there should be some restrictions on file moves (see whatwg/fs#10)... though remove self (whatwg/fs#9) is soon to be supported so perhaps that's not a big deal

Anywho, this seems nice to have so I'll leave the issue open, but I don't see us prioritizing this any time soon

@aetinx
Copy link

aetinx commented Apr 2, 2024

I think a FileSystemHandle.hidden property would be very useful, especially for storing settings from a web app.

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

No branches or pull requests

5 participants