Skip to content

Commit 5afa62c

Browse files
author
bohendo
committed
check cwd node_modules
1 parent f995aec commit 5afa62c

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

crytic_compile/utils/naming.py

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -109,10 +109,13 @@ def convert_filename(
109109
if not filename.exists():
110110
# how node.js loads dependencies from node_modules:
111111
# https://nodejs.org/api/modules.html#loading-from-node_modules-folders
112-
for folder in cwd.parents:
113-
if folder.joinpath(Path("node_modules"), filename).exists():
114-
filename = folder.joinpath("node_modules", filename)
115-
break
112+
if cwd.joinpath(Path("node_modules"), filename).exists():
113+
filename = cwd.joinpath("node_modules", filename)
114+
else:
115+
for folder in cwd.parents:
116+
if folder.joinpath(Path("node_modules"), filename).exists():
117+
filename = folder.joinpath(Path("node_modules"), filename)
118+
break
116119
if not filename.exists():
117120
if cwd.joinpath(Path("contracts"), filename).exists():
118121
filename = cwd.joinpath("contracts", filename)

0 commit comments

Comments
 (0)