Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions src/line.rs
Original file line number Diff line number Diff line change
Expand Up @@ -287,10 +287,10 @@ fn render_file<R: gimli::Reader>(
}

fn path_push(path: &mut String, p: &str) {
if has_unix_root(p) || has_windows_root(p) {
if has_forward_slash_root(p) || has_backward_slash_root(p) {
*path = p.to_string();
} else {
let dir_separator = if has_windows_root(path.as_str()) {
let dir_separator = if has_backward_slash_root(path.as_str()) {
'\\'
} else {
'/'
Expand All @@ -304,11 +304,11 @@ fn path_push(path: &mut String, p: &str) {
}

/// Check if the path in the given string has a unix style root
fn has_unix_root(p: &str) -> bool {
p.starts_with('/')
fn has_forward_slash_root(p: &str) -> bool {
p.starts_with('/') || p.get(1..3) == Some(":/")
}

/// Check if the path in the given string has a windows style root
fn has_windows_root(p: &str) -> bool {
fn has_backward_slash_root(p: &str) -> bool {
p.starts_with('\\') || p.get(1..3) == Some(":\\")
}