Windows support: install-path probing + platform notes

- Blender discovery adds the Windows versioned install dir (Program Files/
  Blender Foundation/Blender */blender.exe); ODA adds Program Files/ODA
  (both still env > PATH first; shutil.which resolves .exe via PATHEXT)
- README cross-platform section: pathlib + explicit UTF-8 I/O + bytes-decoded
  subprocesses throughout; Windows advice (PYTHONUTF8=1, LongPathsEnabled,
  ODA as the primary DWG path since libredwg is rare there)

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
2026-07-04 15:10:44 +08:00
parent b871a2f8bd
commit a6856f903d
3 changed files with 17 additions and 1 deletions

View File

@@ -8,6 +8,8 @@ Blender to produce GLBs. Its manifest is consumed by write_web_showcase.py.
from __future__ import annotations
import argparse
import sys
import glob
import shutil
import os
import copy
@@ -40,13 +42,17 @@ VARIANTS = [
def default_blender() -> str:
"""Blender executable: env BLENDER > PATH > macOS app-bundle default."""
"""Blender executable: env BLENDER > PATH > platform install defaults."""
override = os.environ.get("BLENDER")
if override:
return override
found = shutil.which("blender")
if found:
return found
if sys.platform == "win32":
hits = sorted(glob.glob(r"C:/Program Files/Blender Foundation/Blender */blender.exe"))
if hits:
return hits[-1]
return "/Applications/Blender.app/Contents/MacOS/Blender"

View File

@@ -4,6 +4,7 @@
from __future__ import annotations
import argparse
import glob
import fnmatch
import json
import os
@@ -93,6 +94,13 @@ def oda_converter() -> str | None:
found = shutil.which("ODAFileConverter")
if found:
return found
if sys.platform == "win32":
hits = sorted(
glob.glob(r"C:/Program Files/ODA/*/ODAFileConverter.exe")
+ glob.glob(r"C:/Program Files (x86)/ODA/*/ODAFileConverter.exe")
)
if hits:
return hits[-1]
default = Path("/Applications/ODAFileConverter.app/Contents/MacOS/ODAFileConverter")
return str(default) if default.exists() else None