Skip to content

Conversation

@FlooferLand
Copy link
Contributor

@FlooferLand FlooferLand commented Jun 9, 2025

This uses the new web filesystem access APis, making GodSVG no longer save a new file to the downloads folder.

This instead prompts the user once to save a file and stores a handle to that file that we can later write to all we want.

There are some limitations; Mainly, the handle for each file has to be requested again any time the user loads up GodSVG again, as well as the first time the user saves after loading a brand new file, but this isn't problematic and it still beats saving as a new file every time.

This PR works on my machine; I've tested saving/loading files, multiple tabs, and exporting. I haven't tested this thoroughly however and I'd appreciate if someone would before merging (Especially the XML colour palette saving? Not sure what that is about)

See also: https://developer.chrome.com/docs/capabilities/web-apis/file-system-access

@FlooferLand FlooferLand force-pushed the chrome-web-filesystem branch from 8c2ed5d to ce0872e Compare June 9, 2025 04:42
@FlooferLand FlooferLand marked this pull request as draft June 9, 2025 04:43
@FlooferLand
Copy link
Contributor Author

FlooferLand commented Jun 9, 2025

Hmm.. This used to work right as I made this PR, but something broke regarding callback arguments.
No matter what I try to do, the debug console.log("ARGS: ", args) I have in _web_on_file_saved always prints undefined to the console and GDScript errors out when trying to access those values

This uses the new web filesystem access APis, making GodSVG no longer save a new file to the downloads folder.
This instead prompts the user once to save a file and stores a handle to that file that we can later write to all we want.
There are some limitations; Mainly, the handle for each file has to be requested again any time the user loads up GodSVG again, but this isn't that problematic and right now I'm doing it any time the user saves the file again.

See: https://developer.chrome.com/docs/capabilities/web-apis/file-system-access
@FlooferLand FlooferLand force-pushed the chrome-web-filesystem branch from ce0872e to e583321 Compare June 10, 2025 00:23
@FlooferLand FlooferLand marked this pull request as ready for review June 10, 2025 00:24
@FlooferLand
Copy link
Contributor Author

Everything was fixed and tested, but I'd appreciate further testing

Fixes a bug there the file could show up as "[ Unsaved ]" or "[ Empty ]", while over-all making things more tidy
@FlooferLand FlooferLand marked this pull request as draft August 17, 2025 04:54
@FlooferLand
Copy link
Contributor Author

For anyone interested, there were internal discussions and this PR is far too broken and flawed rn to be merged.
I think I'll pick it up again, since its so useful and improves the user experience loads, but rn its very messy and doesn't work right.

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