diff --git a/jinja_helper.py b/jinja_helper.py index 06d5f09..534f5b0 100644 --- a/jinja_helper.py +++ b/jinja_helper.py @@ -1,7 +1,7 @@ import jinja2 import os -def render_path(path, install_location, game_directory): +def render_path(path, install_location, game_directory,): # sanity check input path # if not path.endswith(".reg.j2"): @@ -17,9 +17,10 @@ def render_path(path, install_location, game_directory): template = jinja2.Template(input_content) print("in", input_content) + # render # output_content = template.render( - install_dir=os.path.join(install_location, game_directory).replace("\\", "\\\\"), + install_dir=install_location.replace("\\", "\\\\"), user_home=os.path.expanduser("~").replace("\\", "\\\\") ) diff --git a/software.py b/software.py index d18cbc1..af75d8f 100644 --- a/software.py +++ b/software.py @@ -64,6 +64,8 @@ class Software: '''Extract a cached, downloaded zip to the target location''' software_path = os.path.join(target, self.title) + if os.path.isdir(software_path): + return # TODO better skip os.makedirs(software_path, exist_ok=True) with zipfile.ZipFile(cache_src, 'r') as zip_ref: @@ -109,7 +111,9 @@ class Software: for rf in self.reg_files: path = self.backend.get(rf, cache_dir=self.cache_dir) if path.endswith(".j2"): - path = jinja_helper.render_path(path, self.backend.install_dir, self.directory) + target_install_dir = os.path.join(self.backend.install_dir, self.title) + print("Install dir Registry:", target_install_dir) + path = jinja_helper.render_path(path, target_install_dir, self.directory) localaction.install_registry_file(path)