1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
|
diff --git a/cli/tray.py b/cli/tray.py
index a282cfb..349971c 100755
--- a/cli/tray.py
+++ b/cli/tray.py
@@ -272,7 +272,7 @@ class TaskbarPanel:
subprocess.run(["xdg-open", path])
def _open_logs(self):
- log_file_path = os.path.join(get_program_files_directory(), LOG_FILE_NAME)
+ log_file_path = os.path.join(get_user_data_directory(), LOG_FILE_NAME)
if os.path.exists(log_file_path):
try:
self.open_location(log_file_path)
diff --git a/core/application.py b/core/application.py
index b568168..f1f67e6 100755
--- a/core/application.py
+++ b/core/application.py
@@ -39,17 +39,17 @@ class Application:
):
try:
self.log_file_path = os.path.join(
- get_program_files_directory(), log_file_path
+ get_user_data_directory(), log_file_path
)
self.data_file_path = os.path.join(
- get_program_files_directory(), data_file_path
+ get_user_data_directory(), data_file_path
)
self.mutex_identifier = mutex_identifier
if PLATFORM == MACOS or PLATFORM.startswith(LINUX):
self.lock_file = None # File(lock) object
self.mutex_identifier = os.path.join(
- get_program_files_directory(), self.mutex_identifier
+ get_user_data_directory(), self.mutex_identifier
)
self.config = Config(
@@ -86,7 +86,7 @@ class Application:
sys.exit(0)
elif PLATFORM == MACOS or PLATFORM.startswith(LINUX):
if PLATFORM == MACOS:
- app_dir = get_program_files_directory()
+ app_dir = get_user_data_directory()
if not os.path.exists(app_dir):
try:
os.makedirs(app_dir)
diff --git a/core/constants.py b/core/constants.py
index 5551f5e..37f58e1 100755
--- a/core/constants.py
+++ b/core/constants.py
@@ -159,3 +159,9 @@ def get_downloads_folder():
- Linux: /home/<Username>/Downloads
"""
return os.path.join(get_user_home_directory(), "Downloads")
+
+def get_user_data_directory():
+ """
+ Get the path to the user's configuration directory.
+ """
+ return os.path.join(get_user_home_directory(), ".clipcascade")
\ No newline at end of file
diff --git a/gui/tray.py b/gui/tray.py
index ccd43a7..9ff1356 100755
--- a/gui/tray.py
+++ b/gui/tray.py
@@ -290,7 +290,7 @@ class TaskbarPanel:
subprocess.run(["xdg-open", path])
def _open_logs(self, icon, item):
- log_file_path = os.path.join(get_program_files_directory(), LOG_FILE_NAME)
+ log_file_path = os.path.join(get_user_data_directory(), LOG_FILE_NAME)
if os.path.exists(log_file_path):
try:
self.open_location(log_file_path)
@@ -348,16 +348,16 @@ class TaskbarPanel:
return
except RuntimeError as re:
target_directory = os.path.join(
- get_program_files_directory(), "downloads"
+ get_user_data_directory(), "downloads"
)
if not os.path.exists(target_directory):
os.makedirs(target_directory)
logging.error(
f"A runtime error occurred while starting filedialog to select a directory. Error: {re}.\n"
- + f"Setting the default location to the program directory '{target_directory}'."
+ + f"Setting the default location to the config directory '{target_directory}'."
)
CustomDialog(
- f"ClipCascade 📥: Saving files to the program directory '{target_directory}'.",
+ f"ClipCascade 📥: Saving files to the config directory '{target_directory}'.",
msg_type="info",
timeout=5000,
).mainloop()
|