I have the following code:
//on WINDOWS:
Path path = Paths.get("photos\\vacation"); // windows
Path path1 = Paths.get("yellowstone");
Path path2 = path.relativize(path1);
System.out.print(path2);
output: ../yellowstone
//on LINUX
Path path = Paths.get("photos/vacation"); // unix
Path path1 = Paths.get("yellowstone");
Path path2 = path.relativize(path1);
System.out.print(path2);
output: ../../yellowstone
Why do I get two different relative paths? The official javadoc mentions only that if both paths have a root component (which is not the case) the result will be system dependent.
Is there a different rule for windows? Thanks in advance.