Keep temporary files in memory #3128
Replies: 1 comment
-
I made a simple In-Memory file system implementation (untested) that can link an in-memory directory to another AbstractFileSystem's directory, that delays all destructive actions to those other file systems to when a
Regardless of this piece of code (that I think is not fully usable in GDevelop as it is), I really think that this enhancement idea is very important. The cloud is nice and all, but it is just a very very bad idea to use it for temporary files in the web app. The problems it causes include:
Additionally the electron app relies way too much on the local file system for no good reason:
If we just keep the auto-generated files in memory and use a service worker to allow accessing those in-memory files as if they were hosted (take the example of StackBlitz), we immediately get rid of:
|
Beta Was this translation helpful? Give feedback.
-
Description
GDevelop produces two kinds of temporary files when making previews, code files for events-based extensions and code files for scene event sheets. This is not a bad thing in itself, but it causes problems in the context of the web app, where there is no filesystem. Right now the solution is to upload them to an s3, but this comes with a few issues:
My solution
My solution would be to keep files in memory. To do so, I think it would be better to rework the preview system to just... not use the filesystem. My idea is to use a service worker to intercept any traffic to the preview "site", to handle it from the IDE. There, we could return the temporary files that have been kept in-memory. Additionally, if we want the web app to work offline, we could pre-download the gdjs runtime and "serve" it via the service worker alongside the temporary files.
For events-based extension though, this would not suffice, as we still need an include path to give to the
gd::PlatformExtension
. For that, we could introduce a "marker" to tell the platform extension to fetch it from the in-memory filesystem (for example, if the include path begins withmemory::
, get the path that follows it from the in-memory filesystem).Additional notes
gd::Project
orgd::Platform
.Beta Was this translation helpful? Give feedback.
All reactions