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

Allow Multiple Installed Versions #87

Open
dsanders11 opened this issue Jul 11, 2023 · 2 comments
Open

Allow Multiple Installed Versions #87

dsanders11 opened this issue Jul 11, 2023 · 2 comments
Labels
area:versions ✨ enhancement New feature or request

Comments

@dsanders11
Copy link
Member

Currently fiddle-core continually swaps the installed version (via Installer) into Paths.electronInstall as needed. Fiddle can have multiple windows, each with a different version of Electron selected. These two paradigms are at odds with each other since running two different fiddles with different Electron versions will cause the second run to try to replace the files of the first one.

The current approach has the distinct advantage that there's only ever one installed version extracted on disk, so even if no cleanup is performed, at worse the files for a single version remain extracted. The limitation on multiple installed versions is somewhat problematic, though. A better default behavior may be to use temp directories and have Runner remove them as clean up. This would be a breaking change.

@AlokYadavCodes
Copy link
Contributor

Hi @dsanders11 ,
I have been looking into this issue and wanted to share some thoughts about the clean up strategy.

While I understand your proposal to clean up in Runner when the fiddle is stopped, but this would require unzipping the Electron binary every time a fiddle runs, even when using the same version repeatedly.

I would like to suggest a potentially better approach:

  • Extract each version to a unique subdirectory without overwriting (as you suggested).
  • Clean up all these subdirectories when the Fiddle app closes, using app.on('window-all-closed') in main.ts of Fiddle Repo.

This way, each version only needs to be unzipped once.
Let me know your thoughts!

@dsanders11
Copy link
Member Author

@AlokYadavCodes, you're right that unzipping for each fiddle run is less than ideal.

but this would require unzipping the Electron binary every time a fiddle runs, even when using the same version repeatedly.

To support #98 we'll still need to handle the case of separate copies of the same Electron version because the fuse settings might be different, and we need to have them isolated.

Building on what you've written, I think a viable approach would be:

  • Installer creates a temporary directory (using fs.mkdtemp) where it will unzip Electron versions instead of the current electronInstall directory. The directory name would be the name of the ZIP (e.g. electron-v31.7.3-darwin-arm64) prepended with a hash of custom fuse settings if there are any (that way there's only one copy of the version with any given fuse settings).
  • Add a new Installer.dispose method which Fiddle could call on close to dispose of these temporary files.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area:versions ✨ enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants