| 1 | package config |
| 2 | |
| 3 | // RecoveryCopyAutoCleanupEnabled reports the user-global |
| 4 | // recovery_cleanup.auto_enabled setting (default true). It decodes only that |
| 5 | // table: adding a typed field to Config would push ratcheted |
| 6 | // config.go/render.go over their repolint budgets, and the setting is consumed |
| 7 | // by the desktop recovery-copy sweep only (#8525/#8750/#9109). A settings-UI |
| 8 | // save may drop the manually written section. |
| 9 | func RecoveryCopyAutoCleanupEnabled() bool { |
| 10 | path := userConfigLoadPath() |
| 11 | if path == "" { |
| 12 | return true |
| 13 | } |
| 14 | var partial struct { |
| 15 | RecoveryCleanup struct { |
| 16 | AutoEnabled *bool `toml:"auto_enabled"` |
| 17 | } `toml:"recovery_cleanup"` |
| 18 | } |
| 19 | if _, err := decodeTOMLFile(path, &partial); err != nil { |
| 20 | return true |
| 21 | } |
| 22 | return partial.RecoveryCleanup.AutoEnabled == nil || *partial.RecoveryCleanup.AutoEnabled |
| 23 | } |
| 24 |