aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/makefile/functions.rs12
1 files changed, 10 insertions, 2 deletions
diff --git a/src/makefile/functions.rs b/src/makefile/functions.rs
index 295e50f..a78d582 100644
--- a/src/makefile/functions.rs
+++ b/src/makefile/functions.rs
@@ -287,7 +287,7 @@ mod file_name {
use std::env;
use std::ffi::OsStr;
use std::fs;
- use std::path::Path;
+ use std::path::{Path, MAIN_SEPARATOR};
use eyre::WrapErr;
@@ -302,8 +302,9 @@ mod file_name {
.parent()
.and_then(Path::to_str)
.filter(|x| !x.is_empty())
- .unwrap_or("./")
+ .unwrap_or(".")
})
+ .map(|x| format!("{}{}", x, MAIN_SEPARATOR))
.collect::<Vec<_>>();
Ok(words.join(" "))
}
@@ -607,6 +608,13 @@ mod test {
}
#[test]
+ fn dir() -> R {
+ let result = call!(dir "src/foo.c hacks");
+ assert_eq!(result, format!("src{0} .{0}", std::path::MAIN_SEPARATOR));
+ Ok(())
+ }
+
+ #[test]
fn notdir() -> R {
let result = call!(notdir "src/foo.c hacks");
assert_eq!(result, "foo.c hacks");