Fix Windows path handling

ninja_syntax.py should be writing native
platform paths instead of converting
things to unix paths.

Separately, fixed type errors introduced
by the previous commit.
This commit is contained in:
2024-03-04 08:17:51 -07:00
parent 192191ced2
commit 6debc74abf
2 changed files with 36 additions and 30 deletions

View File

@@ -21,6 +21,7 @@ use Python.
import re
import textwrap
import os
from io import StringIO
from pathlib import Path
from typing import Dict, List, Match, Optional, Tuple, Union
@@ -215,7 +216,12 @@ class Writer(object):
def serialize_path(input: Optional[NinjaPath]) -> str:
return str(input).replace("\\", "/") if input else ""
if not input:
return ""
if isinstance(input, Path):
return str(input).replace("/", os.sep)
else:
return str(input)
def serialize_paths(input: Optional[NinjaPathOrPaths]) -> List[str]: