This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| function replaceHome($pathArray) { | |
| # Check whether the first three paths are equal to HOME | |
| # If it is, it substitutes it for ~ | |
| # Change this accordingly, if your home path is more than three | |
| # paths long. | |
| $splitChar = [System.IO.Path]::DirectorySeparatorChar | |
| if ( ($pathArray.Length -gt 2) -and | |
| (($pathArray[0..2] -join $splitChar) -eq $HOME)) { | |
| @("~") + $pathArray[3..$pathArray.Length] | |
| } |