Skip to content

Commit

Permalink
fix(buckets): Avoid error messages for unexpected dir
Browse files Browse the repository at this point in the history
  • Loading branch information
HUMORCE committed Jun 20, 2023
1 parent 1d14058 commit 9b8ae95
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
2 changes: 1 addition & 1 deletion lib/buckets.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ function list_buckets {
$bucket.Updated = Invoke-Git -Path $path -ArgumentList @('log', '--format=%aD', '-n', '1') | Get-Date
} else {
$bucket.Source = friendly_path $path
$bucket.Updated = (Get-Item "$path\bucket").LastWriteTime
$bucket.Updated = (Get-Item "$path\bucket" -ErrorAction SilentlyContinue).LastWriteTime
}
$bucket.Manifests = Get-ChildItem "$path\bucket" -Force -Recurse -ErrorAction SilentlyContinue |
Measure-Object | Select-Object -ExpandProperty Count
Expand Down
8 changes: 5 additions & 3 deletions lib/core.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -529,9 +529,11 @@ function fullpath($path) {
$ExecutionContext.SessionState.Path.GetUnresolvedProviderPathFromPSPath($path)
}
function friendly_path($path) {
$h = (Get-PsProvider 'FileSystem').home; if(!$h.endswith('\')) { $h += '\' }
if($h -eq '\') { return $path }
return "$path" -replace ([regex]::escape($h)), "~\"
$h = $([System.Environment]::GetFolderPath('UserProfile'))
if ($h -eq '\') { return $path }
$p = $path.Replace($h, '~')
if ($p -eq '~') { return '~\' }
return "$p"
}
function is_local($path) {
($path -notmatch '^https?://') -and (test-path $path)
Expand Down

0 comments on commit 9b8ae95

Please sign in to comment.