| 356 | if let Some(dlc_name) = parts.next() { |
| 357 | let dlc = dlc_name.as_os_str().to_string_lossy(); |
| 358 | let rest = parts.as_path(); |
| 359 | if rest.as_os_str().is_empty() { |
| 360 | return format!("dlc://{dlc}/"); |
| 361 | } |
| 362 | return format!("dlc://{dlc}/{}", path_slash_for_doctor(rest)); |
| 363 | } |
| 364 | } |
| 365 | path_slash_for_doctor(path) |
| 366 | } |
| 367 | |
| 368 | fn path_slash_for_doctor(path: &Path) -> String { |
| 369 | path.to_string_lossy().replace('\\', "/") |
| 370 | } |
| 371 | |
| 372 | fn line_number_at(text: &str, byte_index: usize) -> usize { |
| 373 | text[..byte_index.min(text.len())] |
| 374 | .bytes() |
| 375 | .filter(|b| *b == b'\n') |
| 376 | .count() |
| 377 | + 1 |
| 378 | } |
| 379 | |
| 380 | fn strip_comments_for_doctor(text: &str, hash_line_comment: bool) -> String { |
| 381 | let mut out = Vec::with_capacity(text.len()); |