How Compare Path?

See this:

let path1 = Path::new("dire");
let path2 = Path::new("dire/../dire");
println!("{}", path1==path2);

Its output is false, but we know those path is equals. They just are a same dire.
How do I do?

3 Likes

Not always, by the way.

mkdir example
cd example/
mkdir -p a/b/c
touch a/b/dire
ln -s a/b/c dire 

ls -l dire dire/../dire
ls -Lld dire dire/../dire

In the example dire is a symlink to a directory, and dire/../dire is a file.

5 Likes

This topic was automatically closed 90 days after the last reply. We invite you to open a new topic if you have further questions or comments.