fix path check

This commit is contained in:
Jay Lee 2017-04-10 05:25:12 +08:00
parent b46c147fed
commit c5f07eda41

View File

@ -367,7 +367,16 @@ fn determine_operation(matches: &Matches) -> FmtResult<Operation> {
});
}
let files: Vec<_> = matches.free.iter().map(PathBuf::from).collect();
let files: Vec<_> = matches
.free
.iter()
.map(|s| {
let p = PathBuf::from(s);
// we will do comparison later, so here tries to canonicalize first
// to get the expected behavior.
p.canonicalize().unwrap_or(p)
})
.collect();
Ok(Operation::Format {
files: files,