macos: disable auto-updates for local (source) builds

The auto-update prompt isn't useful for local (source) builds so disable
both update checks and automatic downloads.

There are multiple ways we could check if we've been built for source,
but the easiest and least intrusive approach is to check the value of
the 'GhosttyCommit' Info.plist key. Because it is only set as part of
the release build process, an empty key implies that we've been build
from source.
This commit is contained in:
Jon Parise
2024-12-26 22:21:10 -05:00
committed by Jonathan Lopez
parent f9c9a80493
commit 821a8f00c5

View File

@ -485,10 +485,16 @@ class AppDelegate: NSObject,
}
// Sync our auto-update settings
updaterController.updater.automaticallyChecksForUpdates =
config.autoUpdate == .check || config.autoUpdate == .download
updaterController.updater.automaticallyDownloadsUpdates =
config.autoUpdate == .download
// Local (source) builds always disable the updater
if let commit = Bundle.main.infoDictionary?["GhosttyCommit"] as? String, !commit.isEmpty {
updaterController.updater.automaticallyChecksForUpdates =
config.autoUpdate == .check || config.autoUpdate == .download
updaterController.updater.automaticallyDownloadsUpdates =
config.autoUpdate == .download
} else {
updaterController.updater.automaticallyChecksForUpdates = false
updaterController.updater.automaticallyDownloadsUpdates = false
}
// Config could change keybindings, so update everything that depends on that
syncMenuShortcuts(config)