From 87f57a9675dffed4f09eaf57fb84c4f1a1069839 Mon Sep 17 00:00:00 2001 From: Yannik Schmidt Date: Wed, 21 Feb 2024 08:12:03 +0100 Subject: [PATCH] wip: regfile install --- .../registry_files/game_path_example_1.reg | Bin 248 -> 250 bytes localaction.py | 14 ++++++++++++++ regedit.py | 14 ++++++++++++++ 3 files changed, 28 insertions(+) create mode 100644 regedit.py diff --git a/example_software_root/FreeDink/registry_files/game_path_example_1.reg b/example_software_root/FreeDink/registry_files/game_path_example_1.reg index 2396c4ce04d8c34bd0fe46312e1960c29e8af456..5ea2dd00e1bb5aa5d9789f1c1345ed12e6d17319 100644 GIT binary patch delta 19 Xcmeyt_=|DEJ02qjB?evwE-(fFJ>LWY delta 17 Vcmeyx_=9o6J1!*#UIs2O1^_g71I+*c diff --git a/localaction.py b/localaction.py index 4152b34..68ee6ce 100644 --- a/localaction.py +++ b/localaction.py @@ -1,3 +1,6 @@ +import subprocess +import os + def _template_registry_file(template_file, game_path=None): '''Template the registry file before installation''' pass @@ -9,6 +12,17 @@ def unpack_software(software_cache_path, target_path): def install_registry_file(registry_file, game_path=None): '''Install a given registy file''' + # test path: + # ./example_software_root/FreeDink/registry_files/game_path_example_1.reg + + # windows sucky sucky # + if not os.path.isabs(registry_file): + registry_file = os.path.join(os.getcwd(), registry_file) + p = subprocess.Popen(["python", "regedit.py", registry_file], + subprocess.PIPE, stderr=subprocess.PIPE, universal_newlines=True) + + print(p.communicate()) + def install_extra_files(extra_files_list, path): '''Copy/Install extra gamedata to a give location''' pass diff --git a/regedit.py b/regedit.py new file mode 100644 index 0000000..aa1e560 --- /dev/null +++ b/regedit.py @@ -0,0 +1,14 @@ +from pyuac.main_decorator import main_requires_admin +import sys +import subprocess + +@main_requires_admin(return_output=True) +def main(registry_file): + p = subprocess.Popen(["regedit", registry_file], + subprocess.PIPE, stderr=subprocess.PIPE, universal_newlines=True) + stdout, stderr = p.communicate() + +if __name__ == '__main__': + registry_file = sys.argv[-1] + rv = main(registry_file) + print(rv) \ No newline at end of file