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

Support file-dir duality #117

Open
SoniEx2 opened this issue May 12, 2023 · 2 comments
Open

Support file-dir duality #117

SoniEx2 opened this issue May 12, 2023 · 2 comments

Comments

@SoniEx2
Copy link

SoniEx2 commented May 12, 2023

It would be nice if the filesystem API were allowed to support file-dir duality, tho we wouldn't expect most implementations to support it.

Many filesystems, from Mac "System 7" to Windows NTFS, and beyond, exhibit some form of file-dir duality. Whether the wasi runtime should expose it is another question, and will depend on the wasi runtime's goals, but it would be nice if it were at least allowed.

@sunfishcode
Copy link
Member

What is file-dir duality? And how would applications use it?

@SoniEx2
Copy link
Author

SoniEx2 commented May 19, 2023

sometimes you really want both file and dir contents in the same filesystem node. some systems use these for resource forks. since POSIX doesn't have file-dir duality, and arguably forbids file-dir duality, most POSIX apps use the .d convention. a dir ending in .d is a dir associated with the file lacking the .d. this is most commonly seen in /etc, where you'll have a file like profile and dir like profile.d will hold extra scripts related to profile, or you'll have user.conf and user.conf.d again following roughly the same structure. (these files really wanna be under their parent's namespace, but POSIX doesn't allow it. isn't that unfortunate? we could fix it tho!)

programming languages could use file-dir duality to allow submodules to be loaded from a file-dir node: instead of having, say, foo.rs and foo/bar.rs, you could have foo.rs and foo.rs/bar.rs. the main benefit of this comes when you expose these through a tab-completion interface: file-dir duality allows e.g. f<tab> to always expand to foo.rs, only requiring additional typing for submodules. without file-dir duality, every tab-completion option - except the .d convention, for things that support it - requires multiple <tab>s to complete.

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