Implement global settings file (#30444)

Adds a `global_settings.json` file which can be set up by enterprises
with automation, enabling setting settings like edit provider by default
without interfering with user's settings files.

Release Notes:

- N/A

---------

Co-authored-by: Marshall Bowers <git@maxdeviant.com>
This commit is contained in:
Tristan Hume 2025-05-13 02:29:32 -04:00 committed by GitHub
parent c6e69fae17
commit 90c2d17042
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 210 additions and 40 deletions

View file

@ -191,6 +191,12 @@ pub fn settings_file() -> &'static PathBuf {
SETTINGS_FILE.get_or_init(|| config_dir().join("settings.json"))
}
/// Returns the path to the global settings file.
pub fn global_settings_file() -> &'static PathBuf {
static GLOBAL_SETTINGS_FILE: OnceLock<PathBuf> = OnceLock::new();
GLOBAL_SETTINGS_FILE.get_or_init(|| config_dir().join("global_settings.json"))
}
/// Returns the path to the `settings_backup.json` file.
pub fn settings_backup_file() -> &'static PathBuf {
static SETTINGS_FILE: OnceLock<PathBuf> = OnceLock::new();