Merge pull request #1441 from MartyGentillon/master

Fixed bug where $home doesn't support .endswith
This commit is contained in:
Luke Sampson
2017-04-21 08:47:36 +10:00
committed by GitHub
+1 -1
View File
@@ -87,7 +87,7 @@ function fullpath($path) { # should be ~ rooted
}
function relpath($path) { "$($myinvocation.psscriptroot)\$path" } # relative to calling script
function friendly_path($path) {
$h = $home; if(!$h.endswith('\')) { $h += '\' }
$h = "$env:userprofile"; if(!$h.endswith('\')) { $h += '\' }
if($h -eq '\') { return $path }
return "$path" -replace ([regex]::escape($h)), "~\"
}