From 1b9bd06fedfc404dc18fa1777f7dabd1f62c9f69 Mon Sep 17 00:00:00 2001 From: synth Date: Sat, 27 Apr 2024 18:40:37 +0200 Subject: [PATCH] Add path check for offset json --- offsets/update_offsets.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/offsets/update_offsets.py b/offsets/update_offsets.py index 155d607..f367a93 100644 --- a/offsets/update_offsets.py +++ b/offsets/update_offsets.py @@ -2,10 +2,17 @@ import sys import requests import json import re +import os source_url = "https://raw.githubusercontent.com/a2x/cs2-dumper/main/output/offsets.json" commits_url = "https://api.github.com/repos/a2x/cs2-dumper/commits" -dest_path = "./offsets/offsets.json" +if os.path.isfile("./offsets/offsets.json"): + dest_path = "./offsets/offsets.json" +elif os.path.isfile("./offsets.json"): + dest_path = "./offsets.json" +else: + print("Invalid path for 'offsets.json'") + exit() # Fetch the source JSON source_response = requests.get(source_url)