diff --git a/CHANGELOG.md b/CHANGELOG.md index a55eed4..e5c2fa7 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1 +1,2 @@ -- Added voice mixing functionality that enables combining multiple voices into a single "Mixed voice", as suggested by @PulsarFTW in #1. (Special thanks to @jborza for making this feature possible with his contributions in #5) \ No newline at end of file +- Added voice mixing functionality that enables combining multiple voices into a single "Mixed voice", as suggested by @PulsarFTW in #1. (Special thanks to @jborza for making this feature possible with his contributions in #5) +- Switched to platformdirs for determining the correct desktop path, instead of using old methods. \ No newline at end of file diff --git a/abogen/conversion.py b/abogen/conversion.py index 1b2a4f5..7fa8c89 100644 --- a/abogen/conversion.py +++ b/abogen/conversion.py @@ -4,6 +4,7 @@ import tempfile import time import chardet import charset_normalizer +from platformdirs import user_desktop_dir from PyQt5.QtCore import QThread, pyqtSignal, Qt from PyQt5.QtWidgets import QCheckBox, QVBoxLayout, QDialog, QLabel, QDialogButtonBox import soundfile as sf @@ -280,7 +281,7 @@ class ConversionThread(QThread): base_path = self.display_path if self.display_path else self.file_name base_name = os.path.splitext(os.path.basename(base_path))[0] if self.save_option == "Save to Desktop": - parent_dir = os.path.join(os.path.expanduser("~"), "Desktop") + parent_dir = user_desktop_dir() elif self.save_option == "Save next to input file": parent_dir = os.path.dirname(base_path) else: diff --git a/abogen/gui.py b/abogen/gui.py index 1f52886..2cc5f4d 100644 --- a/abogen/gui.py +++ b/abogen/gui.py @@ -72,6 +72,7 @@ from constants import ( ) from threading import Thread from voice_formula_gui import VoiceFormulaDialog +from platformdirs import user_desktop_dir # Import ctypes for Windows-specific taskbar icon if platform.system() == "Windows": @@ -1628,7 +1629,7 @@ class abogen(QWidget): try: # where to put the .lnk - desktop = os.path.join(os.environ.get("USERPROFILE", ""), "Desktop") + desktop = user_desktop_dir() shortcut_path = os.path.join(desktop, "abogen.lnk") # target exe diff --git a/pyproject.toml b/pyproject.toml index 03491fe..7f626a6 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -18,6 +18,7 @@ dependencies = [ "ebooklib>=0.18", "beautifulsoup4>=4.13.4", "PyMuPDF>=1.25.5", + "platformdirs>=4.3.7", "soundfile>=0.13.1", "pygame>=2.6.1", "charset_normalizer>=3.4.1",