summaryrefslogtreecommitdiffstats
path: root/src/modules/directory.rs
diff options
context:
space:
mode:
authorMatan Kushner <hello@matchai.me>2019-05-16 09:40:30 -0600
committerGitHub <noreply@github.com>2019-05-16 09:40:30 -0600
commit2cf69a82b7fcb4d61c853f54488e0b02d301033e (patch)
treed84889473d6bfe3f5b014c8afc945f918cda916b /src/modules/directory.rs
parent90d6e6cf0b22520a5177e8e842acbb142482e4eb (diff)
ci: Fix CI to work with changes to Azure Pipelines build agent (#55)
Diffstat (limited to 'src/modules/directory.rs')
-rw-r--r--src/modules/directory.rs9
1 files changed, 4 insertions, 5 deletions
diff --git a/src/modules/directory.rs b/src/modules/directory.rs
index e0f4a9e12..710f73593 100644
--- a/src/modules/directory.rs
+++ b/src/modules/directory.rs
@@ -21,6 +21,7 @@ pub fn segment(context: &Context) -> Option<Module> {
module.set_style(module_color);
let current_dir = &context.current_dir;
+ log::debug!("Current directory: {:?}", current_dir);
let dir_string;
if let Some(repo_root) = &context.repo_root {
@@ -58,7 +59,7 @@ fn contract_path(full_path: &Path, top_level_path: &Path, top_level_replacement:
format!(
"{replacement}{separator}{path}",
replacement = top_level_replacement,
- separator = std::path::MAIN_SEPARATOR,
+ separator = "/",
path = full_path
.strip_prefix(top_level_path)
.unwrap()
@@ -76,15 +77,13 @@ fn truncate(dir_string: String, length: usize) -> String {
return dir_string;
}
- let components = dir_string
- .split(std::path::MAIN_SEPARATOR)
- .collect::<Vec<&str>>();
+ let components = dir_string.split("/").collect::<Vec<&str>>();
if components.len() <= length {
return dir_string;
}
let truncated_components = &components[components.len() - length..];
- truncated_components.join(&std::path::MAIN_SEPARATOR.to_string())
+ truncated_components.join("/")
}
#[cfg(test)]