Skip to content

The only downloader you need. 下载器的集大成者。

refactor(paths): 回切 QStandardPaths,移除 platformdirs

XiaoYouChR66a10684ea5c
diff --git a/app/config/paths.py b/app/config/paths.py
index 0aadb4a4..4bde970b 100644
--- a/app/config/paths.py
+++ b/app/config/paths.py
@@ -4,7 +4,7 @@ import shutil
import sys
from pathlib import Path
-from platformdirs import user_data_path, user_downloads_path
+from PySide6.QtCore import QStandardPaths
EXECUTABLE_DIR = (
Path(sys.executable).resolve().parent
@@ -15,7 +15,9 @@ EXECUTABLE_DIR = (
APP_DATA_DIR = (
EXECUTABLE_DIR / "GhostDownloader"
if (EXECUTABLE_DIR / "GhostDownloader").is_dir()
- else user_data_path("GhostDownloader", appauthor=False)
+ else Path(QStandardPaths.writableLocation(
+ QStandardPaths.StandardLocation.GenericDataLocation
+ )) / "GhostDownloader"
)
PORTABLE_DIR = EXECUTABLE_DIR / "GhostDownloader"
@@ -26,9 +28,13 @@ FEATURES_DIR = (
if "__compiled__" not in globals()
else APP_DATA_DIR / "features"
)
-USER_DATA_DIR = user_data_path("GhostDownloader", appauthor=False)
+USER_DATA_DIR = Path(QStandardPaths.writableLocation(
+ QStandardPaths.StandardLocation.GenericDataLocation
+)) / "GhostDownloader"
-DOWNLOAD_DIR = user_downloads_path()
+DOWNLOAD_DIR = Path(QStandardPaths.writableLocation(
+ QStandardPaths.StandardLocation.DownloadLocation
+))
def isPortable() -> bool:
diff --git a/pyproject.toml b/pyproject.toml
index b0b8aa56..26c642f0 100644
--- a/pyproject.toml
+++ b/pyproject.toml
@@ -22,7 +22,6 @@ dependencies = [
"uvloop>=0.22.1; sys_platform != 'win32'",
"pyobjc-framework-Cocoa>=10.0; sys_platform == 'darwin'",
"pyobjc-framework-Quartz>=10.0; sys_platform == 'darwin'",
- "platformdirs>=4",
]
[dependency-groups]
diff --git a/uv.lock b/uv.lock
index 6362b287..c90a1f41 100644
--- a/uv.lock
+++ b/uv.lock
@@ -320,7 +320,6 @@ dependencies = [
{ name = "m3u8" },
{ name = "mpegdash" },
{ name = "nuitka" },
- { name = "platformdirs" },
{ name = "pyobjc-framework-cocoa", marker = "sys_platform == 'darwin'" },
{ name = "pyobjc-framework-quartz", marker = "sys_platform == 'darwin'" },
{ name = "pyside6" },
@@ -353,7 +352,6 @@ requires-dist = [
{ name = "m3u8", specifier = ">=6.0.0" },
{ name = "mpegdash", specifier = ">=0.4.1" },
{ name = "nuitka", specifier = ">=4.2" },
- { name = "platformdirs", specifier = ">=4" },
{ name = "pyobjc-framework-cocoa", marker = "sys_platform == 'darwin'", specifier = ">=10.0" },
{ name = "pyobjc-framework-quartz", marker = "sys_platform == 'darwin'", specifier = ">=10.0" },
{ name = "pyside6", specifier = "~=6.10.3" },
@@ -549,15 +547,6 @@ wheels = [
{ url = "https://files.pythonhosted.org/packages/63/34/ba1c580383c9eada3711951fef0795c80b829a078d72188184bcab9dd527/packaging-26.3-py3-none-any.whl", hash = "sha256:d7193f7c8e4e93f444fde0262bf90af30e16fa0ad0ad44cb553c87339b23cd1c", size = 129956, upload-time = "2026-08-04T18:15:27.159Z" },
]
-[[package]]
-name = "platformdirs"
-version = "4.11.7"
-source = { registry = "https://pypi.org/simple" }
-sdist = { url = "https://files.pythonhosted.org/packages/69/b7/802a56eca9f2fac455b8bab5375a2647b0f0e14a2cd63ef077de3c4a7658/platformdirs-4.11.7.tar.gz", hash = "sha256:4f41487eeeeeb07f3a6625e61d9bc0ae6809f92d3386dbd74392fbb76108104d", size = 35127, upload-time = "2026-09-01T13:35:10.502Z" }
-wheels = [
- { url = "https://files.pythonhosted.org/packages/27/6e/80993e10a0482f630cef528635789233224f36b1ffd11592aa15d13ff9ce/platformdirs-4.11.7-py3-none-any.whl", hash = "sha256:8a02cb259042c79d1cd0450facc2fe6dc9d303ae7901afbe33bf8ea0b188cef6", size = 23938, upload-time = "2026-09-01T13:35:09.02Z" },
-]
-
[[package]]
name = "pluggy"
version = "1.6.0"