mirror of
https://github.com/safishamsi/graphify.git
synced 2026-08-28 01:06:36 +00:00
fix(windows): read .graphify_root BOM-tolerantly in the update-recovery path too (#3028)
Complete the read-side BOM fix: the graphify update (no-args) recovery path at cli.py read .graphify_root with plain utf-8, so a PowerShell-written BOM would fail the exists() check and abort with path not found. Switch it to utf-8-sig like the other five reader sites. Also clean up two invalid-escape f-strings in the windows skillgen test.
This commit is contained in:
+5
-1
@@ -2274,7 +2274,11 @@ def dispatch_command(cmd: str) -> None:
|
||||
# Try to recover the scan root saved by the last full build
|
||||
saved = Path(_GRAPHIFY_OUT) / ".graphify_root"
|
||||
if saved.exists():
|
||||
watch_path = Path(saved.read_text(encoding="utf-8").strip())
|
||||
# utf-8-sig: a marker written by Windows PowerShell 5.1 carries a
|
||||
# UTF-8 BOM that plain utf-8 keeps as U+FEFF (not stripped by
|
||||
# .strip()), which would make this recovered path fail exists()
|
||||
# (#3028). Match the other .graphify_root readers.
|
||||
watch_path = Path(saved.read_text(encoding="utf-8-sig").strip())
|
||||
else:
|
||||
watch_path = Path(".")
|
||||
if not watch_path.exists():
|
||||
|
||||
@@ -1107,10 +1107,10 @@ def test_windows_skill_writes_marker_files_without_a_bom():
|
||||
"""
|
||||
core, _ = _platform_artifacts("windows")
|
||||
for marker in (".graphify_python", ".graphify_root"):
|
||||
assert f"Out-File -FilePath graphify-out\{marker} -Encoding utf8" not in core, (
|
||||
assert f"Out-File -FilePath graphify-out\\{marker} -Encoding utf8" not in core, (
|
||||
f"the windows render still writes {marker} with a BOM-emitting Out-File"
|
||||
)
|
||||
assert f"WriteAllText((Join-Path $PWD 'graphify-out\{marker}')" in core, (
|
||||
assert f"WriteAllText((Join-Path $PWD 'graphify-out\\{marker}')" in core, (
|
||||
f"{marker} must be written through WriteAllText with a BOM-less encoding"
|
||||
)
|
||||
assert "New-Object System.Text.UTF8Encoding $false" in core, \
|
||||
|
||||
Reference in New Issue
Block a user