Commit 11beaba changed the approach for canonical on Windows, which leads to malfunction of the 'relative' function applied to cases, where the first argument is not on the same drive as the second. Previously this returned an empty path and/or an error code, which is no longer the case. Now this leads to non-existent paths like ''......\C$\temp\somefile" without any indication of an error.
How to reproduce:
On the command line issue the following commands to define network path mappings to two different drives, e.g.
net use X: \\localhost\C$\temp
net use B: \\localhost\E$\somedir
touch C:\temp\somefile
mkdir E:\somedir\test
The following test program
int main() {
boost::filesystem::path abs("X:/somefile");
boost::filesystem::path relToDest("B:/test");
boost::system::error_code ec;
auto relMapped = boost::filesystem::relative("X:/somefile", "B:/test", ec);
std::cout << "relative path: " << relMapped << "\n";
std::cout << "error code: " << ec << "\n";
return 0;
}
returns:
relative path: "..\..\..\C$\temp\somefile"
error code: system:0
The same issue occurs with 'real' network paths, the above example is only to make this reproduceable on a local machine.
Commit 11beaba changed the approach for canonical on Windows, which leads to malfunction of the 'relative' function applied to cases, where the first argument is not on the same drive as the second. Previously this returned an empty path and/or an error code, which is no longer the case. Now this leads to non-existent paths like ''......\C$\temp\somefile" without any indication of an error.
How to reproduce:
On the command line issue the following commands to define network path mappings to two different drives, e.g.
The following test program
returns:
The same issue occurs with 'real' network paths, the above example is only to make this reproduceable on a local machine.