Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion tests/test_report_paths.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@

# Tools that use report_paths and must not define their own copy again.
SHARED = ("anim_index", "awc_manifest", "bink_index", "gamedata_index", "gamedata_xml", "gen_d3d12_stubs",
"glb_inspect", "meshlet_page", "navmesh_index", "rpf_probe", "tile_probe", "world_index",
"glb_inspect", "meshlet_page", "navmesh_index", "rpf_probe", "tile_probe", "ttpf_mips", "world_index",
"world_lights_paths", "world_names")
# The one tool that still carries its own copy (an open pull request edits its call site). Do not add to this list:
# import report_paths instead.
Expand Down
14 changes: 3 additions & 11 deletions tools/ttpf_mips.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@
sys.path.insert(0, os.path.dirname(os.path.abspath(__file__)))
import bcpack # noqa: E402
import bcpack_tables_bptc as _bptc # noqa: E402
from report_paths import same_report_path # noqa: E402
from tex_headers import ( # noqa: E402
array_surface_layout, compact_surface_layout, cubemap_surface_layout,
decode_etpf_chunk_pages, etpf_streaming_padding, gfx10_tile_bytes,
Expand Down Expand Up @@ -1493,15 +1494,6 @@ def analyze(pool, index, *, allow_bcpack=True):

# --- commands --------------------------------------------------------------

def same_output_path(first, second):
if os.path.normcase(os.path.realpath(first)) == os.path.normcase(os.path.realpath(second)):
return True
try:
return os.path.samefile(first, second)
except OSError:
return False


def find_pools(arg):
"""Pools under a game root (data/ttdb and pack/*/data/ttdb), or, for any other folder such as data/ttdb
itself or one pack, every .ttpf below it. A file is taken as a pool."""
Expand Down Expand Up @@ -2185,7 +2177,7 @@ def main(argv=None):
print(f"ERROR: --json {a.json} is a directory", file=sys.stderr)
return 2
for p in pools:
if same_output_path(a.json, p):
if same_report_path(a.json, p):
print(f"ERROR: --json would overwrite the input {p}", file=sys.stderr)
return 2
try:
Expand All @@ -2205,7 +2197,7 @@ def main(argv=None):
continue
if label == "--history file" and not os.path.isfile(asset):
continue
if same_output_path(a.out, asset):
if same_report_path(a.out, asset):
print(f"ERROR: {a.out} would overwrite the {label} {asset}", file=sys.stderr)
return 2
try:
Expand Down
Loading