From f6b0c1b66cfeb2f3fabad3310785091000cc31bf Mon Sep 17 00:00:00 2001 From: Stephen Albert-Moore Date: Fri, 20 Jan 2023 16:05:40 -0500 Subject: [PATCH] fix(scoop-info) `--verbose` file size collection - Use full path for files - Do not attempt to measure `Length` of directories in the tree Co-authored-by: Richard Kuhnt --- CHANGELOG.md | 1 + libexec/scoop-info.ps1 | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index ec4d91723b..8d856f9e18 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -15,6 +15,7 @@ - **core:** Fix `is_in_dir` under Unix ([#5391](https://github.com/ScoopInstaller/Scoop/issues/5391)) - **env:** Avoid automatic expansion of `%%` in env ([#5395](https://github.com/ScoopInstaller/Scoop/issues/5395)) - **install:** Fix download from private GitHub repositories ([#5361](https://github.com/ScoopInstaller/Scoop/issues/5361)) +- **scoop-info:** Fix errors in file size collection when `--verbose` ([#5352](https://github.com/ScoopInstaller/Scoop/pull/5352)) ### Code Refactoring diff --git a/libexec/scoop-info.ps1 b/libexec/scoop-info.ps1 index 625a3c6463..675611435d 100644 --- a/libexec/scoop-info.ps1 +++ b/libexec/scoop-info.ps1 @@ -112,7 +112,7 @@ if ($status.installed) { # Collect file list from each location $appFiles = Get-ChildItem $appsdir -Filter $app - $currentFiles = Get-ChildItem $appFiles -Filter (Select-CurrentVersion $app $global) + $currentFiles = Get-ChildItem $appFiles.FullName -Filter (Select-CurrentVersion $app $global) $persistFiles = Get-ChildItem $persist_dir -ErrorAction Ignore # Will fail if app does not persist data $cacheFiles = Get-ChildItem $cachedir -Filter "$app#*" @@ -120,7 +120,7 @@ if ($status.installed) { $fileTotals = @() foreach ($fileType in ($appFiles, $currentFiles, $persistFiles, $cacheFiles)) { if ($null -ne $fileType) { - $fileSum = (Get-ChildItem $fileType -Recurse | Measure-Object -Property Length -Sum).Sum + $fileSum = (Get-ChildItem $fileType.FullName -Recurse -File | Measure-Object -Property Length -Sum).Sum $fileTotals += coalesce $fileSum 0 } else { $fileTotals += 0