mirror of
https://github.com/denizsafak/abogen.git
synced 2026-07-18 13:40:27 +02:00
Use platformdirs for finding the desktop path
This commit is contained in:
@@ -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:
|
||||
|
||||
+2
-1
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user