Skip to content

Add directory picker to web target#554

Open
timo-drick wants to merge 4 commits intovinceglb:mainfrom
timo-drick:add_directory_picker_to_web_target
Open

Add directory picker to web target#554
timo-drick wants to merge 4 commits intovinceglb:mainfrom
timo-drick:add_directory_picker_to_web_target

Conversation

@timo-drick
Copy link
Copy Markdown
Contributor

@timo-drick timo-drick commented Mar 30, 2026

Adding support for a directory picker.
It is still based on the input field with the webkitdirectory attribute:
https://developer.mozilla.org/en-US/docs/Web/HTML/Reference/Elements/input#webkitdirectory
https://developer.mozilla.org/en-US/docs/Web/API/File/webkitRelativePath
It is supported on most modern browsers.
Therefore a change in the PlatformFile was necessary. I created an interface.
The current implementation creates virtual directories because the input form returns a list of all files recursively from the user selected directory. Than a virtual tree is build in memory and linked to a virtual root directory.
Moved following PlatformFile extension functions to common:

  • path
  • parent()
  • isRegularFile()
  • isDirectory()
  • list()

I am also experimenting with FileSystemAccessApi. Which does allow to support more real access to the host file system. Including write access and also maybe bookmarking of resources (Limited to chromium based browsers).
Other than that it is maybe also possible to support a sandbox filesystem based on thr File System API:
https://developer.mozilla.org/en-US/docs/Web/API/File_System_API
Than web Filekit could also provide this files and cache directory with read/write access.
I think what maybe missing in the PlatformFile is an extension function where you can check if the File/Directory is writeable.
(And also maybe if a file/directory do has read access allowed?)

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

Successfully merging this pull request may close these issues.

1 participant