Function foundry_compilers::utils::resolve_absolute_library
source · pub fn resolve_absolute_library(
root: &Path,
cwd: &Path,
import: &Path
) -> Option<(PathBuf, PathBuf)>Expand description
Tries to find an absolute import like src/interfaces/IConfig.sol in cwd, moving up the path
until the root is reached.
If an existing file under root is found, this returns the path up to the import path and the
normalized import path itself:
For example for following layout:
<root>/mydependency/
├── src (`cwd`)
│ ├── interfaces
│ │ ├── IConfig.sol
and import as src/interfaces/IConfig.sol and cwd as src this will return
(<root>/mydependency/, <root>/mydependency/src/interfaces/IConfig.sol)