Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow library users to use a custom current working directory #551

Merged
merged 2 commits into from
Mar 20, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions crytic_compile/crytic_compile.py
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ def __init__(self, target: Union[str, AbstractPlatform], **kwargs: str) -> None:

Args:
target (Union[str, AbstractPlatform]): Target
**kwargs: additional arguments
**kwargs: additional arguments. Used: "cwd"
"""

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

self._working_dir = Path.cwd()
custom_cwd = kwargs.get("cwd")
if custom_cwd is not None:
self._working_dir = Path(custom_cwd)
else:
self._working_dir = Path.cwd()

# pylint: disable=too-many-nested-blocks
if isinstance(target, str):
Expand Down
Loading