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

[Feature Request]: Web File System API's showOpenFilePicker() should remember previous directory #42352

Open
3 tasks done
absidue opened this issue Jun 3, 2024 · 3 comments
Open
3 tasks done
Labels
enhancement ✨ has-repro-gist Issue can be reproduced with code at https://gist.github.com/ platform/all web-platform-apis

Comments

@absidue
Copy link

absidue commented Jun 3, 2024

Preflight Checklist

Electron Version

30.0.2

What operating system are you using?

Windows

Operating System Version

Windows 10 19045.4412

What arch are you using?

x64

Last Known Working Electron version

No response

Expected Behavior

The Web File System API's showOpenFilePicker() function has an option to specify an id. The browser (in this case Electron) should remember the directory that you last selected a file from and if you call the function again with the same ID, it should open the file picker to that directory.

  1. Click button to open the file picker
  2. Navigate to a directory that isn't the default one
  3. Pick a file
  4. Click the button again to open the file picker
  5. You should be seeing the same directory that you picked the first file from.

Actual Behavior

Electron always opens the file picker to the default location or the well-known directory set in the startIn option.

Testcase Gist URL

https://gist.github.com/absidue/8124af98e9971c17b1455cc6c38aab3d

Additional Information

No response

@electron-issue-triage electron-issue-triage bot added 30-x-y has-repro-gist Issue can be reproduced with code at https://gist.github.com/ labels Jun 3, 2024
@codebytere
Copy link
Member

@absidue this is not supported at the moment, and explicitly logs that to the console:

[3396:0604/110611.311958:INFO:file_system_access_permission_context.cc(588)] NOTIMPLEMENTED GetLastPickedDirectory

I can certain consider taking a look at adding it in the future though!

@codebytere codebytere changed the title [Bug]: Web File System API's showOpenFilePicker() doesn't remember previous directory [Feature Request]: Web File System API's showOpenFilePicker() doesn't remember previous directory Jun 4, 2024
@codebytere codebytere changed the title [Feature Request]: Web File System API's showOpenFilePicker() doesn't remember previous directory [Feature Request]: Web File System API's showOpenFilePicker() should remember previous directory Jun 4, 2024
@absidue
Copy link
Author

absidue commented Jun 4, 2024

Oh goodness! I'm really sorry, I completely missed that log message.

Thank you for implementing the Web File System API in Electron, the stuff that is already implemented works great!

@codebytere
Copy link
Member

@absidue no worries :D I can try to give it a go - the main reason I didn't initially was that the feature relies on Chromium mechanics we don't have a comparable existing concept of, so we'd have to roll our own store for per-origin picker settings associated with a given Browser context.

https://chromium-review.googlesource.com/c/chromium/src/+/2645845 is the upstream impl

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement ✨ has-repro-gist Issue can be reproduced with code at https://gist.github.com/ platform/all web-platform-apis
Projects
No open projects
Status: 👀 Unsorted Items
Development

No branches or pull requests

2 participants