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