Show More
@@ -160,20 +160,28 impl ConfigLayer { | |||
|
160 | 160 | // `Path::join` with an absolute argument correctly ignores the |
|
161 | 161 | // base path |
|
162 | 162 | let filename = dir.join(&get_path_from_bytes(&filename_bytes)); |
|
163 |
|
|
|
164 |
|
|
|
163 | match std::fs::read(&filename) { | |
|
164 | Ok(data) => { | |
|
165 | layers.push(current_layer); | |
|
166 | layers.extend(Self::parse(&filename, &data)?); | |
|
167 | current_layer = | |
|
168 | Self::new(ConfigOrigin::File(src.to_owned())); | |
|
169 | } | |
|
170 | Err(error) => { | |
|
171 | if error.kind() != std::io::ErrorKind::NotFound { | |
|
172 | return Err(ConfigParseError { | |
|
165 | 173 | origin: ConfigOrigin::File(src.to_owned()), |
|
166 | 174 | line, |
|
167 | 175 | message: format_bytes!( |
|
168 | 176 | b"cannot include {} ({})", |
|
169 | 177 | filename_bytes, |
|
170 |
format_bytes::Utf8( |
|
|
178 | format_bytes::Utf8(error) | |
|
171 | 179 | ), |
|
172 | 180 | } |
|
173 |
|
|
|
174 | layers.push(current_layer); | |
|
175 | layers.extend(Self::parse(&filename, &data)?); | |
|
176 | current_layer = Self::new(ConfigOrigin::File(src.to_owned())); | |
|
181 | .into()); | |
|
182 | } | |
|
183 | } | |
|
184 | } | |
|
177 | 185 | } else if let Some(_) = EMPTY_RE.captures(&bytes) { |
|
178 | 186 | } else if let Some(m) = SECTION_RE.captures(&bytes) { |
|
179 | 187 | section = m[1].to_vec(); |
General Comments 0
You need to be logged in to leave comments.
Login now