Small QoL for tools/UpdatePaths (#93482)

## About The Pull Request

Added the ability to drag and drop multiple files with scripts onto
`Update Paths.bat` instead of just one.

<img width="979" height="275" alt="изображение"
src="https://github.com/user-attachments/assets/986a3ecc-803a-487a-80c6-54932ac94437"
/>

## Why It's Good For The Game

It is faster and easier to use!
## Changelog
Not needed?
This commit is contained in:
Cornka
2025-10-18 19:45:29 +02:00
committed by GitHub
parent 217a2ac957
commit 249f4400a4
+8 -5
View File
@@ -177,9 +177,12 @@ def main(args):
print("Using replacement:", args.update_source)
updates = [args.update_source]
else:
with open(args.update_source) as f:
updates = [line for line in f if line and not line.startswith("#") and not line.isspace()]
print(f"Using {len(updates)} replacements from file:", args.update_source)
updates = []
for source in args.update_source:
with open(source) as f:
updates_from_file = [line for line in f if line and not line.startswith("#") and not line.isspace()]
print(f"Using {len(updates_from_file)} replacements from file:", source)
updates.extend(updates_from_file)
if args.map:
update_map(args.map, updates, verbose=args.verbose)
@@ -191,10 +194,10 @@ def main(args):
if __name__ == "__main__":
prog = __spec__.name.replace('.__main__', '')
if os.name == 'nt' and len(sys.argv) <= 1:
print("usage: drag-and-drop a path script .txt onto `Update Paths.bat`\n or")
print("usage: drag-and-drop one or more .txt path script onto `Update Paths.bat`\n or")
parser = argparse.ArgumentParser(prog=prog, description=desc, formatter_class=argparse.RawTextHelpFormatter)
parser.add_argument("update_source", help="update file path / line of update notation")
parser.add_argument("update_source", nargs="+", help="update file path(s) / line of update notation")
parser.add_argument("--map", "-m", help="path to update, defaults to all maps in maps directory")
parser.add_argument("--directory", "-d", help="path to maps directory, defaults to _maps/")
parser.add_argument("--inline", "-i", help="treat update source as update string instead of path", action="store_true")