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

HTML5 builds should allow users to access the filesystem on the host #1443

Closed
umarcor opened this issue Aug 31, 2020 · 5 comments
Closed

HTML5 builds should allow users to access the filesystem on the host #1443

umarcor opened this issue Aug 31, 2020 · 5 comments

Comments

@umarcor
Copy link

umarcor commented Aug 31, 2020

Describe the project you are working on:

This applies to any game/tool that allows users to load/save files. The project I'm working on is a diagram editor based on GraphEdit and GraphNode.

Describe the problem or limitation you are having in your project:

I want to allow users to load or save files. Currently, using FileDialog on Windows works as expected. However, HTML5 builds are executed in a sandbox (/home/web_user). Hence, users can save and load the files in the sandbox, but cannot export them to or import them from outside. As a result, the experience is very inconsistent.

Describe the feature / enhancement and how it helps to overcome the problem or limitation:

I asked about it in the IRC, and I was told that the host file system cannot be accessed in browsers, due to a security constraint. However, I don't expect the game/tool to access the host file system directly and without authorization. I'm ok with having and using the sandbox for that. Instead, the interactions show be handled through FileDialog.

Describe how your proposal will work, with code, pseudocode, mockups, and/or diagrams:

In regular HTML sites, this is typically done through https://www.w3schools.com/tags/att_input_type_file.asp, which allows the user to select one or multiple files. Conversely, saving content in the file system is done by triggering a download. In both cases, the user browses the host file system explicitly.

If this enhancement will not be used often, can it be worked around with a few lines of script?:

I believe this is not an enhancement, but a currently broken (as in "not completely implemented") feature. It is an undocumented and inconsistent behaviour.

FTR, in Orama-Interactive/Pixelorama they work around it with Pukkah/HTML5-File-Exchange-for-Godot.

Is there a reason why this should be core and not an add-on in the asset library?:

Developers of Godot have stated that supporting native save/load dialogs is undesired. Providing a consistent UX for users of Godot games is preferred over providing consistency to users of games/tools along with other apps on the same host. See godotengine/godot#13177. Still, consistent Godot UX should not be at the expense of removing the most basic functionality. Should it be possible to use the Godot styled dialog, that'd be ok. Otherwise, I believe that the native dialog should be supported in HTML5 builds.

Note that this issue is similar to #1123. However, that is about using native dialogs on any platform; which would fix the HTML5 builds is a result. Conversely, this is about fixing HTML5, which might be done by using native dialogs or (hopefully) through other creative solutions.

@Calinou
Copy link
Member

Calinou commented Aug 31, 2020

Duplicate of #1123.

Developers of Godot have stated that supporting native save/load dialogs is undesired.

It's low-priority, but we definitely plan to support native file dialogs sooner or later, especially as we have to use them for sandboxed mode on macOS.

@umarcor
Copy link
Author

umarcor commented Aug 31, 2020

@Calinou (bolds added by me):

godotengine/godot#13177 (comment)
Sorry, this is not going to happen. The UI may look nicer, but this road was not taken because users preferred to have better previews for resources instead of consistency with the OS. Closing.

godotengine/godot#13177 (comment)
in any case, if you would like the built-in filedialog to support something to make your life easier, feel free to request it

@Calinou
Copy link
Member

Calinou commented Aug 31, 2020

@umarcor I edited my post accordingly after reading comments in that thread 🙂

macOS sandboxed mode didn't exist back when reduz posted that comment (or we weren't aware of its existence).

@umarcor
Copy link
Author

umarcor commented Aug 31, 2020

@Calinou, does marking this as a dup and archiving it imply that HTML5 builds will not be fixed until native dialogs are supported in all platforms?

@Calinou
Copy link
Member

Calinou commented Aug 31, 2020

@umarcor We can edit the documentation, but that's all we can do for now. Note that in any case, anyone is free to open a pull request to fix bugs and improve documentation. You don't need to open a proposal for that.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants