-
Notifications
You must be signed in to change notification settings - Fork 85
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
directoryOpen does not allow creating new files in an empty directory #129
Comments
In fact, yes - including this dirHandle would do it: https://github.com/GoogleChromeLabs/browser-fs-access/blob/main/src/fs-access/directory-open.mjs#L26 |
Since the result needs to be backward-compatible with |
The flag that leads to a "." equivalent being returned as part of the results would work fine by me. |
@beaufortfrancois suggests maybe having a completely new convenience function |
… which adds a handle to the requested directory as well as the content of that directory
… which adds a handle to the requested directory as well as the content of that directory
Sure. I'm not much of a js programmer, but I followed the pattern in the codebase. I chose to delegate to directoryOpen rather than reimplementing most of it - let me know what you think. I will test more thoroughly if the code looks reasonable. |
… which adds a handle to the requested directory as well as the content of that directory
This was fixed in |
directoryOpen() returns a 0 length array of
FileWithDirectoryAndFileHandle
if there is nothing inside the directory having been opened. In my case I'm opening with a mode ofreadwrite
, so Chrome nicely prompts me that the application will have access to the directory. Per https://wicg.github.io/file-system-access/#api-filesystemdirectoryhandle, I can create new files by calling getFileHandle(create=true) on a directory handle; however, because directoryOpen returns 0 length, I don't have a directory handle to create the initial file in.If there's an alternate way to accomplish this, please advise; but, I think the fix is to include a FileSystemDirectoryHandle as part of the directoryOpen response.
(I'm making an app with no server; data is stored in localstorage, and I'm adding sync to and from the filesystem.)
The text was updated successfully, but these errors were encountered: