fix(license): use QUrl.toLocalFile; track docs folder
CI / preflight (push) Waiting to run

- 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
This commit is contained in:
jack
2026-07-13 15:12:02 -07:00
parent d3c5b6fa64
commit 44216e5857
2 changed files with 10 additions and 5 deletions
+1 -1
View File
@@ -21,7 +21,6 @@ env/
*.swp
*.swo
*~
docs
# OS
.DS_Store
@@ -56,3 +55,4 @@ AGENTS.md
CONVENTIONS.md
specs/
graphify-out/
.personal-docs/
+9 -4
View File
@@ -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)