diff --git a/.gitignore b/.gitignore index a375d3f..e768a53 100644 --- a/.gitignore +++ b/.gitignore @@ -21,7 +21,6 @@ env/ *.swp *.swo *~ -docs # OS .DS_Store @@ -56,3 +55,4 @@ AGENTS.md CONVENTIONS.md specs/ graphify-out/ +.personal-docs/ diff --git a/src/pygui/backend/license/license_model.py b/src/pygui/backend/license/license_model.py index 094edf5..e75d8cc 100644 --- a/src/pygui/backend/license/license_model.py +++ b/src/pygui/backend/license/license_model.py @@ -4,9 +4,8 @@ import logging import shutil import time from pathlib import Path -from urllib.parse import unquote, urlparse -from PySide6.QtCore import Property, QObject, Signal, Slot +from PySide6.QtCore import Property, QObject, QUrl, Signal, Slot from pygui.backend.license.license_manager import ( LICENSE_FILENAME_RE, @@ -21,9 +20,15 @@ TRIAL_DAYS = 30 def _to_local_path(path_or_url: str) -> Path: - """Accept both plain paths and file:// URLs (QML FileDialog gives URLs).""" + """Accept both plain paths and file:// URLs (QML FileDialog gives URLs). + + Uses QUrl.toLocalFile() rather than urlparse — a manual + urlparse().path strip leaves a leading slash before a Windows drive + letter (e.g. "/C:/Users/...", not a valid absolute path), which + QUrl's platform-aware conversion handles correctly. + """ if path_or_url.startswith("file:"): - return Path(unquote(urlparse(path_or_url).path)) + return Path(QUrl(path_or_url).toLocalFile()) return Path(path_or_url)