From b0772bcb1c8e25cb8358ffa575d6a12f999a63f8 Mon Sep 17 00:00:00 2001 From: David Yoder Date: Thu, 8 Aug 2024 12:41:58 -0400 Subject: [PATCH] cleanup the path the user enters --- Tools.ps1 | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/Tools.ps1 b/Tools.ps1 index d12a811..691099c 100644 --- a/Tools.ps1 +++ b/Tools.ps1 @@ -778,6 +778,17 @@ Function Get-FileSizes { $IncludeHidden = $false } + # If the path is not an absolute path, make it so + ElseIf ( -not (Test-Path $Path) ) { + $NewPath = $Path[0] + ":\" + If ( -not (Test-Path $NewPath) ) { + Write-Error "Could not find path: ${Path}" + Return + } + $Path = $NewPath + } + } + # Change the sort order depending on which parameter set was specified Switch ( $PSCmdlet.ParameterSetName ) { "largest" { $SortOrder = $true ; $Quantity = $Largest }