Add fix for volume name "C:" missed in merge

This commit is contained in:
aneesh-n 2024-12-03 22:15:26 +05:30
parent 9baa37a73c
commit 60517b2594
No known key found for this signature in database
GPG key ID: 6F5A52831C046F44
2 changed files with 12 additions and 2 deletions

View file

@ -19,7 +19,13 @@ func preProcessTargets(_ fs.FS, _ *[]string) {
// processTarget processes each target in the loop.
// In case of non-windows OS it uses the passed filesys to clean the target.
func processTarget(filesys fs.FS, target string) string {
return filesys.Clean(target)
if target != "" && filesys.VolumeName(target) == target {
// special case to allow users to also specify a volume name "C:" instead of a path "C:\"
target = target + filesys.Separator()
} else {
target = filesys.Clean(target)
}
return target
}
// preProcessPaths processes paths before looping.

View file

@ -31,7 +31,11 @@ func preProcessTargets(filesys fs.FS, targets *[]string) {
// processTarget processes each target in the loop.
// In case of windows the clean up of target is already done
// in preProcessTargets before the loop, hence this is no-op.
func processTarget(_ fs.FS, target string) string {
func processTarget(filesys fs.FS, target string) string {
if target != "" && filesys.VolumeName(target) == target {
// special case to allow users to also specify a volume name "C:" instead of a path "C:\"
target = target + filesys.Separator()
}
return target
}