Skip to content

Commit

Permalink
Use correct config version default number (#1305 by @buhtzz)
Browse files Browse the repository at this point in the history
"config.Config.CONFIG_VERSION" sets the current default version of the config files used by the latest stable BIT release is 6. This fix makes sure that this number is used by default for (empty) config files that don't specificy "config.version" by their own.

In the wild, normal users should never encounter this problem except in some edge cases. But it is highly relevant for unittesting where some of tests do use empty config files.
  • Loading branch information
buhtz authored Sep 22, 2022
1 parent be3c256 commit ff34418
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions common/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,9 @@ class Config(configfile.ConfigFileWithProfiles):
APP_NAME = 'Back In Time'
VERSION = '1.3.2'
COPYRIGHT = 'Copyright (C) 2008-2022 Oprea Dan, Bart de Koning, Richard Bailey, Germar Reitze'

CONFIG_VERSION = 6
"""Latest or highest possible version of Backin Time's config file."""

NONE = 0
AT_EVERY_BOOT = 1
Expand Down Expand Up @@ -195,11 +197,16 @@ def __init__(self, config_path = None, data_path = None):
else:
os.rename(old_path, self._LOCAL_CONFIG_PATH)

# Load global config file
self.load(self._GLOBAL_CONFIG_PATH)

# Append local config file
self.append(self._LOCAL_CONFIG_PATH)

#?Internal version of current config;;self.CONFIG_VERSION
currentConfigVersion = self.intValue('config.version', 5)
# Get the version of the config file
# or assume the highest config version if it isn't set.
currentConfigVersion \
= self.intValue('config.version', self.CONFIG_VERSION)

if currentConfigVersion < self.CONFIG_VERSION:
# config.version value wasn't stored since BiT version 0.9.99.22
Expand Down

0 comments on commit ff34418

Please sign in to comment.