| 1 |
#!/usr/bin/env python3 |
| 2 |
|
| 3 |
import base64 |
| 4 |
import pathlib |
| 5 |
import requests |
| 6 |
import subprocess |
| 7 |
|
| 8 |
def error(msg: str) -> None: |
| 9 |
print('\033[31m' + msg + '\033[0m') |
| 10 |
|
| 11 |
if __name__ == '__main__': |
| 12 |
git_toplevel = subprocess.check_output(['git', 'rev-parse', '--show-toplevel'], |
| 13 |
stderr=subprocess.DEVNULL).decode("ascii").strip() |
| 14 |
if not pathlib.Path(git_toplevel).resolve() == pathlib.Path('.').resolve(): |
| 15 |
error('Please run this script from the root folder ({})'.format(git_toplevel)) |
| 16 |
exit(1) |
| 17 |
|
| 18 |
file = 'include/renderdoc_app.h' |
| 19 |
url = 'https://raw.githubusercontent.com/baldurk/renderdoc/refs/tags/v1.5/renderdoc/api/app/renderdoc_app.h' |
| 20 |
|
| 21 |
print('Syncing {}...'.format(file), end=' ', flush=True) |
| 22 |
req = requests.get(url) |
| 23 |
|
| 24 |
if not req.ok: |
| 25 |
error('Failed to retrieve file: {} {}'.format(req.status_code, req.reason)) |
| 26 |
exit(1) |
| 27 |
|
| 28 |
with open(file, 'wb') as f: |
| 29 |
f.write(req.content) |
| 30 |
|
| 31 |
print('Done') |