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 setting a custom baseCachePath for updater download location #8719

Open
ImVeryLost opened this issue Dec 3, 2024 · 0 comments
Open

Comments

@ImVeryLost
Copy link

  • Electron-Builder Version: 25.1.8
  • Electron-updater Version: 6.3.9
  • Node Version: 20.x
  • Electron Version: 33.0.2
  • Electron Type (current, beta, nightly): current
  • Target: windows, linux, mac

Currently, the following locations are used:

%localAppData%/{updaterCacheDirName}  - windows
{homeDir}/Library/Caches/{updaterCacheDirName} - mac
{homeDir}/.cache/{updaterCacheDirName} - linux

I would like to change the download location to include orgName folder:

%localAppData%/{orgName}/{updaterCacheDirName}  - windows
{homeDir}/Library/Caches/{orgName}/{updaterCacheDirName} - mac
{homeDir}/.cache/{orgName}/{updaterCacheDirName} - linux

however, there is no way to currently do that.

Things i considered:

  1. updaterCacheDirName - it's formed from the sanitized app name + -updater. So there is no way to change it to {orgName}/{appName}, since any slashes will be removed when sanitizing the app name..

  2. baseCacheDir is in AppAdapter class. I can pass a custom AppAdapter when initializing AppUpdater, but then httpExecutor is set to null:

    if (app == null) {
      this.app = new ElectronAppAdapter()
      this.httpExecutor = new ElectronHttpExecutor((authInfo, callback) => this.emit("login", authInfo, callback))
    } else {
      this.app = app
      this.httpExecutor = null as any
    }

I assume thats because the custom AppAdapter is mostly used for tests? AppAdapter doesnt seem to be documented, so I cannot tell if it's something I should be using or not.

I would be willing to make a PR to allow customizing the cache dir, either by: updating the AppUpdater constructor to not set httpExecutor to null, or by adding the baseCacheDir to AllPublishOptions. Let me know if that's something you would consider & which option you would prefer.

Note: I saw this issue for the same feature request, but it's been closed for a while now. I can close this one if you guys want to reopen that one instead.

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

No branches or pull requests

1 participant