Open althonos opened 6 years ago
Agree with exposing any 'hidden' state with an info namespace. But I'd probably not take dotfiles in to consideration at that level. Since 'hide dotfiles' is more of a convention of the OS and not really of the filesystem.
With regards to a wrapper, how about one which just removes hidden files / directories? It could take two switches omit_dotfiles
and omit_hidden
. Rather than set the hidden
flag, it would just create the illusion that they didn't exist in the filesystem?
With regards to a wrapper, how about one which just removes hidden files / directories? It could take two switches omit_dotfiles and omit_hidden. Rather than set the hidden flag, it would just create the illusion that they didn't exist in the filesystem?
I thought that with a HideDotted
wrapper, then you can quite easily filter out the hidden files if needed by your app.
Anyway, I'll open a PR so that we can see we are talking about the same thing ;)
regarding omit_dotfiles
, would it make sense to just add that to the walker? I currently use walk.files
and exclude anything with /.
in the name.
Hi Will,
now that the typing is merged, I was thinking about adding support for a
visibility
(orhidden
) info namespace, with a simplehidden
key.If that does seem like a good idead, I'll start working on a PR.
Concerned filesystems
In the core library, we could probably support:
ZipFS
(I read somewhere it supports a hidden flag in the external attributes of each entry)OSFS
(I'll detail my idea below).I could also add support for hidden files once the namespace is stabilised to:
ISOFS
infs.archive
SMBFS
infs.smbfs
Semantics of OSFS
So here's what the situation about hidden files:
stat.UF_HIDDEN
flag to hide files as wellBut if we were to support it directly that way, there would be an ambiguity on MacOS where we would not really know if a file is just a dotted file or a dotted file with the
UF_HIDDEN
flag as well.So instead, here's what I propose:
stat.UF_HIDDEN
flagand then addind a
HideDotted
wrapper that:hidden
toTrue
if the file is a dotted fileValueError
when trying tosetinfo
with thehidden
flag set to avoid ambiguity