Skip to content

Commit 059db11

Browse files
Updated config handling
1 parent 6e2167e commit 059db11

File tree

3 files changed

+8
-5
lines changed

3 files changed

+8
-5
lines changed

auto_download_sorter.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,15 @@
66

77

88
def load_variables_from_json():
9-
dirname = os.path.join(os.getenv("APPDATA"), "Auto-Download-Cleaner")
9+
dirname = os.path.join(os.getenv("APPDATA"), "Auto-Download-Sorter")
1010
filename = os.path.join(dirname, 'config.json')
1111
try:
1212
with open(filename, "r") as json_file:
1313
loaded_vars = json.load(json_file)
1414
except FileNotFoundError:
1515
# If the config file doesn't exist, return an empty dictionary
16+
print("Config file not found. ")
17+
print("Creating config file...")
1618
return {}
1719
return loaded_vars
1820

library/save.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,8 +57,9 @@ def save_variables_to_json(vars_dict):
5757
if not os.path.exists(app_config):
5858
os.makedirs(app_config)
5959
filename = os.path.join(app_config, "config.json")
60-
with open(filename, "w") as json_file:
61-
json.dump(vars_dict, json_file, indent=4)
60+
if not os.path.exists(filename):
61+
with open(filename, "w") as json_file:
62+
json.dump(vars_dict, json_file, indent=4)
6263

6364

6465
def main():

library/variable.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
run = True
2-
ZIP_DIR = 'D:\\Zip'
2+
ZIP_DIR = 'E:\\Zip'
33
Image = (
44
'.png', '.jpg', '.jpeg', '.gif', '.tiff', '.psd', '.raw', '.bmp', '.heif', '.indd', '.svg', '.ai', '.eps', '.ico',
55
'.webp')
66
Zip = ('.rar', '.zip', '.tar', '.gz', '.7z')
7-
PYTHON_DIR = 'D:\\Python'
7+
PYTHON_DIR = 'E:\\Python'
88
Video = (
99
'.mp4', '.mov', '.wmv', '.avi', '.avchd', '.flv', '.f4v', '.swf', '.mkv', '.webm', '.mng', '.gifv', '.mpg', '.mp2',
1010
'.mpeg', '.mpe', '.mpv', '.ogg', '.m4p', '.m4v', '.wmv', '.mov', '.qt', '.flv', '.swf', '.avchd')

0 commit comments

Comments
 (0)