Codebase list finalrecon / ab941cc
Add a patch to handle upgrade Sophie Brun 1 year, 8 months ago
2 changed file(s) with 34 addition(s) and 0 deletion(s). Raw diff Collapse all Expand all
0 From: Sophie Brun <[email protected]>
1 Date: Wed, 31 Aug 2022 12:28:53 +0200
2 Subject: Copy config.json if required
3
4 Since version 1.1.5, the dir conf contains another file: config.json.
5 It's copied in the user dir $HOME/.config/finalrecon if the user dir does
6 not exist.
7 If it's an upgrade, the user dir already exists but it misses the
8 config.json => check if the file exists and add it.
9 ---
10 settings.py | 9 +++++++++
11 1 file changed, 9 insertions(+)
12
13 diff --git a/settings.py b/settings.py
14 index 5bd8b6d..72c149f 100644
15 --- a/settings.py
16 +++ b/settings.py
17 @@ -18,6 +18,15 @@ else:
18 from shutil import copytree
19 copytree(src_conf_path, conf_path, dirs_exist_ok=True)
20
21 +# Add config.json in conf_path (user misses it in case of upgrade)
22 +if path.exists(conf_file_path):
23 + pass
24 +else:
25 + from shutil import copyfile
26 + import os
27 + copyfile(os.path.join(src_conf_path, 'config.json'), conf_file_path)
28 +
29 +
30 with open(conf_file_path, 'r') as config_file:
31 config_read = config_file.read()
32 config_json = loads(config_read)
0 Copy-config.json-if-required.patch