diff options
author | Seunghun Kim | 2025-03-02 22:59:23 +0900 |
---|---|---|
committer | Seunghun Kim | 2025-03-02 22:59:23 +0900 |
commit | e7daee682947bf2bb8978da2933268d0802a16fd (patch) | |
tree | c7097c804f96c786595aa27d8663ba436e350e24 /fix-write-path.patch | |
download | aur-e7daee682947bf2bb8978da2933268d0802a16fd.tar.gz |
Initial commit
Diffstat (limited to 'fix-write-path.patch')
-rw-r--r-- | fix-write-path.patch | 95 |
1 files changed, 95 insertions, 0 deletions
diff --git a/fix-write-path.patch b/fix-write-path.patch new file mode 100644 index 000000000000..04ff24baf56b --- /dev/null +++ b/fix-write-path.patch @@ -0,0 +1,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() |