mirror of
https://github.com/gurrgur/er-patcher.git
synced 2026-06-13 09:47:54 +00:00
feature: allow running the script from any cwd
This commit is contained in:
parent
e2441c7479
commit
718f15fee8
1 changed files with 7 additions and 0 deletions
|
|
@ -25,6 +25,13 @@ if __name__ == "__main__":
|
||||||
patch = parser.parse_args(patcher_args)
|
patch = parser.parse_args(patcher_args)
|
||||||
|
|
||||||
exe_name = Path("eldenring.exe")
|
exe_name = Path("eldenring.exe")
|
||||||
|
|
||||||
|
# If the script is in the same directory as eldenring.exe, assume that is the game directory.
|
||||||
|
# Otherwise, assume we are already in the game directory.
|
||||||
|
script_dir = Path(os.path.dirname(os.path.realpath(__file__)))
|
||||||
|
if (script_dir / exe_name).exists():
|
||||||
|
os.chdir(script_dir)
|
||||||
|
|
||||||
with open(exe_name, "rb") as f:
|
with open(exe_name, "rb") as f:
|
||||||
exe_hex = f.read().hex()
|
exe_hex = f.read().hex()
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue