aboutsummaryrefslogtreecommitdiff
path: root/src/config/model.rs
diff options
context:
space:
mode:
authorOgulcan Celik <ogulcancelik@gmail.com>2026-06-07 21:53:59 +0300
committerOgulcan Celik <ogulcancelik@gmail.com>2026-06-07 21:54:29 +0300
commit6f459691056b68c2c99d8341b5f8dd4b811a53c1 (patch)
tree24c780f3813945feef4c0b48be1645ac22067691 /src/config/model.rs
parent0a635a3fc1e971030079945a447c73e2b24489f8 (diff)
fix(update): keep windows installs on preview
Diffstat (limited to 'src/config/model.rs')
-rw-r--r--src/config/model.rs15
1 files changed, 12 insertions, 3 deletions
diff --git a/src/config/model.rs b/src/config/model.rs
index c36150f6..528a940c 100644
--- a/src/config/model.rs
+++ b/src/config/model.rs
@@ -30,17 +30,26 @@ impl UpdateChannelConfig {
#[derive(Debug, Clone, Copy, Deserialize)]
#[serde(default)]
pub struct UpdateConfig {
+ #[serde(default = "default_update_channel")]
pub channel: UpdateChannelConfig,
}
impl Default for UpdateConfig {
fn default() -> Self {
Self {
- channel: UpdateChannelConfig::Stable,
+ channel: default_update_channel(),
}
}
}
+fn default_update_channel() -> UpdateChannelConfig {
+ if cfg!(windows) {
+ UpdateChannelConfig::Preview
+ } else {
+ UpdateChannelConfig::Stable
+ }
+}
+
#[derive(Debug, Clone, Copy, PartialEq, Eq, Deserialize, Serialize, Default)]
#[serde(rename_all = "lowercase")]
pub enum ToastDelivery {
@@ -714,9 +723,9 @@ mod tests {
use super::*;
#[test]
- fn update_channel_defaults_stable_and_parses() {
+ fn update_channel_defaults_for_platform_and_parses() {
let default_config = Config::default();
- assert_eq!(default_config.update.channel, UpdateChannelConfig::Stable);
+ assert_eq!(default_config.update.channel, default_update_channel());
let toml = r#"
[update]