Skip to content
This repository was archived by the owner on Nov 6, 2025. It is now read-only.

Commit 358fea5

Browse files
Emergency sync: config broke everything on old installs (#67)
1 parent b484b07 commit 358fea5

File tree

3 files changed

+12
-4
lines changed

3 files changed

+12
-4
lines changed

bak/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
BAK_VERSION = "0.2.0a1"
1+
BAK_VERSION = "0.2.1a1"

bak/configuration/__init__.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33

44
from pathlib import Path
55
from re import sub
6+
from shutil import copy2
67

78
from config import Config, KeyNotFoundError
89

@@ -50,13 +51,15 @@ def __init__(self):
5051
self.config_dir = Path("~/.config").expanduser().resolve()
5152

5253
self.config_file = self.config_dir / 'bak.cfg'
54+
if not self.config_file.exists():
55+
copy2(self.config_dir / 'bak.cfg.default', self.config_file)
5356
_cfg = Config(str(self.config_file))
5457

5558
reload = False
5659
for cfg_value in self.DEFAULT_VALUES:
5760
if cfg_value not in _cfg.as_dict():
58-
with open(self.config_file, 'w') as _file:
59-
_file.write(
61+
with open(self.config_file, 'a') as _file:
62+
_file.writelines(
6063
f"{cfg_value}: {self.DEFAULT_VALUES[cfg_value]}\n")
6164
_file.close()
6265
reload = True

setup.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
'rich==9.1.0']
99

1010
setup(name='bak',
11-
version='0.2.0a1',
11+
version='0.2.1a1',
1212
description='the .bak manager',
1313
author='ChanceNCounter',
1414
author_email='[email protected]',
@@ -28,6 +28,11 @@
2828
config_dir = os.path.expanduser("~/.config")
2929

3030
config_file = os.path.join(config_dir, 'bak.cfg')
31+
default_config = os.path.join(config_dir, 'bak.cfg.default')
3132

3233
if not os.path.exists(config_file):
3334
copy2('bak/default.cfg', config_file)
35+
36+
if not os.path.exists(default_config):
37+
copy2('bak/default.cfg', default_config)
38+

0 commit comments

Comments
 (0)