Skip to content

Commit 9b8ae95

Browse files
committed
fix(buckets): Avoid error messages for unexpected dir
1 parent 1d14058 commit 9b8ae95

File tree

2 files changed

+6
-4
lines changed

2 files changed

+6
-4
lines changed

lib/buckets.ps1

+1-1
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ function list_buckets {
111111
$bucket.Updated = Invoke-Git -Path $path -ArgumentList @('log', '--format=%aD', '-n', '1') | Get-Date
112112
} else {
113113
$bucket.Source = friendly_path $path
114-
$bucket.Updated = (Get-Item "$path\bucket").LastWriteTime
114+
$bucket.Updated = (Get-Item "$path\bucket" -ErrorAction SilentlyContinue).LastWriteTime
115115
}
116116
$bucket.Manifests = Get-ChildItem "$path\bucket" -Force -Recurse -ErrorAction SilentlyContinue |
117117
Measure-Object | Select-Object -ExpandProperty Count

lib/core.ps1

+5-3
Original file line numberDiff line numberDiff line change
@@ -529,9 +529,11 @@ function fullpath($path) {
529529
$ExecutionContext.SessionState.Path.GetUnresolvedProviderPathFromPSPath($path)
530530
}
531531
function friendly_path($path) {
532-
$h = (Get-PsProvider 'FileSystem').home; if(!$h.endswith('\')) { $h += '\' }
533-
if($h -eq '\') { return $path }
534-
return "$path" -replace ([regex]::escape($h)), "~\"
532+
$h = $([System.Environment]::GetFolderPath('UserProfile'))
533+
if ($h -eq '\') { return $path }
534+
$p = $path.Replace($h, '~')
535+
if ($p -eq '~') { return '~\' }
536+
return "$p"
535537
}
536538
function is_local($path) {
537539
($path -notmatch '^https?://') -and (test-path $path)

0 commit comments

Comments
 (0)