Skip to content

Commit

Permalink
fix: normalize windows path to handle solc >=0.8.8 filename lookup
Browse files Browse the repository at this point in the history
  • Loading branch information
0xalpharush committed Mar 22, 2024
1 parent de160c4 commit 4635aa0
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 5 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/pytest.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,4 +40,4 @@ jobs:
pip install solc-select
- name: Run Tests
run: |
pytest tests/test_metadata.py
pytest tests
9 changes: 5 additions & 4 deletions crytic_compile/utils/naming.py
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ def convert_filename(
if elements[0] == "/" or elements[0] == "\\":
elements = elements[1:] # remove '/'
elements[0] = elements[0] + ":/" # add :/
filename = Path(*elements)
filename = Path(*elements).as_posix_path()
else:
filename = Path(filename_txt)

Expand Down Expand Up @@ -188,10 +188,11 @@ def convert_filename(
short = relative

short = relative_to_short(short)

# Starting with v0.8.8 (https://github.com/ethereum/solidity/pull/11545), solc normalizes the paths to not include the drive on Windows,
# so it's important we use posix path here to avoid issues with the path comparison.
return Filename(
absolute=str(absolute),
absolute=absolute.as_posix(),
relative=relative.as_posix(),
short=short.as_posix(),
used=str(used_filename),
used=Path(used_filename).as_posix(),
)
Binary file added tests/call_to_variable-all.sol-0.5.8-legacy.zip
Binary file not shown.

0 comments on commit 4635aa0

Please sign in to comment.