More optimizations

pull/166/head
KnifMelti 2022-09-20 01:32:23 +02:00
parent 6ce3171b67
commit 9133b9bac5
1 changed files with 2 additions and 3 deletions

View File

@ -12,11 +12,11 @@ function Test-ListPath ($ListPath, $UseWhiteList) {
if (Test-Path "$LocalList") { if (Test-Path "$LocalList") {
$dateLocal = (Get-Item "$LocalList").LastWriteTime.ToString("yyyy-MM-dd HH:mm:ss") $dateLocal = (Get-Item "$LocalList").LastWriteTime.ToString("yyyy-MM-dd HH:mm:ss")
} }
$ExternalList = -join($ListPath, "\", $ListType, "_apps.txt")
$PathInfo=[System.Uri]$ListPath $PathInfo=[System.Uri]$ListPath
if($PathInfo.IsUnc){ if($PathInfo.IsUnc){
$PathType="UNC Path" $PathType="UNC Path"
$ExternalList = -join($ListPath, "\", $ListType, "_apps.txt")
if(Test-Path -Path $ExternalList -PathType leaf){ if(Test-Path -Path $ExternalList -PathType leaf){
Write-Host "Given path $ListPath type is $PathType and $ExternalList is available..." Write-Host "Given path $ListPath type is $PathType and $ExternalList is available..."
$dateExternal = (Get-Item "$ExternalList").LastWriteTime.ToString("yyyy-MM-dd HH:mm:ss") $dateExternal = (Get-Item "$ExternalList").LastWriteTime.ToString("yyyy-MM-dd HH:mm:ss")
@ -48,7 +48,6 @@ function Test-ListPath ($ListPath, $UseWhiteList) {
} }
else { else {
$PathType="Local Path" $PathType="Local Path"
$ExternalList = -join($ListPath, "\", $ListType, "_apps.txt")
if(Test-Path -Path $ExternalList -PathType leaf){ if(Test-Path -Path $ExternalList -PathType leaf){
Write-Host "Given path $ListPath type is $PathType and $ExternalList is available..." Write-Host "Given path $ListPath type is $PathType and $ExternalList is available..."
$dateExternal = (Get-Item "$ExternalList").LastWriteTime.ToString("yyyy-MM-dd HH:mm:ss") $dateExternal = (Get-Item "$ExternalList").LastWriteTime.ToString("yyyy-MM-dd HH:mm:ss")
@ -68,8 +67,8 @@ $WingetUpdatePath = "$env:ProgramData\Winget-AutoUpdate"
$ListPath = "https://www.knifmelti.se" $ListPath = "https://www.knifmelti.se"
#$ListPath = "D:\Temp" #$ListPath = "D:\Temp"
#$ListPath = "\\TempSERVER" #$ListPath = "\\TempSERVER"
#$UseWhiteList = $true #$UseWhiteList = $true
#White List or Black List in share/online if differs #White List or Black List in share/online if differs
if ($WingetUpdatePath -ne $ListPath){ if ($WingetUpdatePath -ne $ListPath){
$NoClean = Test-ListPath $ListPath $UseWhiteList $NoClean = Test-ListPath $ListPath $UseWhiteList