lib/Fs/Full.ps1
function Full-Ffn($fn) {Assert-NoPthSepSfx $fn;Rmv-LasChr(Full-Pth $fn)} function Full-Pth($pth){$o=if((Has-Sub $pth ':')-or(Is-PthSepPfx $pth)){return $pth};$o=(Cur-Pth)+$pth;Norm-Pth $o} function Norm-Pth($pth){Norm-Ffn(Ens-PthSfx $pth)} function Norm-Ffn($ffn){Rmv-2DotInPth $o} function Rmv-2DotInPth($pth){ $o=Rpl-Sub $pth '\\' '\' $o=Rpl-Sub $o '\.\' '\'; if(!(Has-Sub $o '..')){return $o} if($pth-eq'..'){throw "fail Rmv-2DotInPth -pth[$pth]"} $ay=Split-PthSep $o $u=Ub $ay $ay1=($u..0)|%{ if(($ay[$_]) -eq '..'){return $skip++} if($skip){$skip--}else{$ay[$_]} } (Reverse-Ay $ay1) -join (Pth-Sep) } |