From 44216e585732502fc931776da26b5068ff826f21 Mon Sep 17 00:00:00 2001 From: jack Date: Mon, 13 Jul 2026 15:12:02 -0700 Subject: [PATCH] fix(license): use QUrl.toLocalFile; track docs folder - QUrl.toLocalFile() prevents leading slash on Windows drive letters (e.g. "/C:/Users/...") that was causing Path operations to fail - remove docs/ from .gitignore so document revisions are tracked in Git --- .gitignore | 2 +- src/pygui/backend/license/license_model.py | 13 +++++++++---- 2 files changed, 10 insertions(+), 5 deletions(-) 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)