|
1 | | -use foundry_compilers_core::{ |
2 | | - error::{SolcError, SolcIoError}, |
3 | | - utils::find_case_sensitive_existing_file, |
4 | | -}; |
| 1 | +use foundry_compilers_core::error::{SolcError, SolcIoError}; |
5 | 2 | use serde::{Deserialize, Serialize}; |
6 | 3 | use std::{ |
7 | 4 | collections::BTreeMap, |
@@ -145,20 +142,22 @@ impl Source { |
145 | 142 | Self::read(file).map_err(|err| { |
146 | 143 | let exists = err.path().exists(); |
147 | 144 | if !exists && err.path().is_symlink() { |
148 | | - SolcError::ResolveBadSymlink(err) |
149 | | - } else { |
150 | | - // This is an additional check useful on OS that have case-sensitive paths, See also <https://docs.soliditylang.org/en/v0.8.17/path-resolution.html#import-callback> |
151 | | - if !exists { |
152 | | - // check if there exists a file with different case |
153 | | - if let Some(existing_file) = find_case_sensitive_existing_file(file) { |
154 | | - SolcError::ResolveCaseSensitiveFileName { error: err, existing_file } |
155 | | - } else { |
156 | | - SolcError::Resolve(err) |
157 | | - } |
158 | | - } else { |
159 | | - SolcError::Resolve(err) |
| 145 | + return SolcError::ResolveBadSymlink(err); |
| 146 | + } |
| 147 | + |
| 148 | + // This is an additional check useful on OS that have case-sensitive paths, |
| 149 | + // see also <https://docs.soliditylang.org/en/v0.8.17/path-resolution.html#import-callback> |
| 150 | + // check if there exists a file with different case |
| 151 | + #[cfg(feature = "walkdir")] |
| 152 | + if !exists { |
| 153 | + if let Some(existing_file) = |
| 154 | + foundry_compilers_core::utils::find_case_sensitive_existing_file(file) |
| 155 | + { |
| 156 | + return SolcError::ResolveCaseSensitiveFileName { error: err, existing_file }; |
160 | 157 | } |
161 | 158 | } |
| 159 | + |
| 160 | + SolcError::Resolve(err) |
162 | 161 | }) |
163 | 162 | } |
164 | 163 |
|
|
0 commit comments