Skip to content

Commit 3c088df

Browse files
authored
Merge pull request #551 from crytic/frabert/custom-cwd
Allow library users to use a custom current working directory
2 parents 9b80771 + f3e7785 commit 3c088df

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

crytic_compile/crytic_compile.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,7 @@ def __init__(self, target: Union[str, AbstractPlatform], **kwargs: str) -> None:
124124
125125
Args:
126126
target (Union[str, AbstractPlatform]): Target
127-
**kwargs: additional arguments
127+
**kwargs: additional arguments. Used: "cwd"
128128
"""
129129

130130
# dependencies is needed for platform conversion
@@ -145,7 +145,11 @@ def __init__(self, target: Union[str, AbstractPlatform], **kwargs: str) -> None:
145145
# Note: line 1 is at index 0
146146
self._cached_line_to_code: Dict[Filename, List[bytes]] = {}
147147

148-
self._working_dir = Path.cwd()
148+
custom_cwd = kwargs.get("cwd")
149+
if custom_cwd is not None:
150+
self._working_dir = Path(custom_cwd)
151+
else:
152+
self._working_dir = Path.cwd()
149153

150154
# pylint: disable=too-many-nested-blocks
151155
if isinstance(target, str):

0 commit comments

Comments
 (0)