Skip to content

Commit

Permalink
parametrise target path
Browse files Browse the repository at this point in the history
  • Loading branch information
ross-mcnairn-dev committed May 31, 2024
1 parent 10fa4f9 commit 3987569
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/python_redlines/engines.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@


class XmlPowerToolsEngine(object):
def __init__(self):
def __init__(self, target_path: Optional[str] = None):
self.target_path = target_path
self.extracted_binaries_path = self.__unzip_binary()

def __unzip_binary(self):
Expand All @@ -23,7 +24,7 @@ def __unzip_binary(self):
"""
base_path = os.path.dirname(__file__)
binaries_path = os.path.join(base_path, 'dist')
target_path = os.path.join(base_path, 'bin')
target_path = self.target_path if self.target_path else os.path.join(base_path, 'bin')

if not os.path.exists(target_path):
os.makedirs(target_path)
Expand All @@ -47,7 +48,6 @@ def __extract_binary(self, zip_path: str, target_path: str):
zip_path: str - The path to the zip file
target_path: str - The path to extract the binary to
"""
print(f"")
if zip_path.endswith('.zip'):
with zipfile.ZipFile(zip_path, 'r') as zip_ref:
zip_ref.extractall(target_path)
Expand Down

0 comments on commit 3987569

Please sign in to comment.