This now exists as the pathdiff
crate, using the code from kennytm's answer
You can use it as:
extern crate pathdiff;
pathdiff::diff_paths(path, base);
where base
is where the relative path should be applied to obtain path
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…