Update deps
This commit is contained in:
15
vendor/github.com/adrg/xdg/internal/pathutil/pathutil_windows.go
generated
vendored
15
vendor/github.com/adrg/xdg/internal/pathutil/pathutil_windows.go
generated
vendored
@@ -1,6 +1,8 @@
|
||||
package pathutil
|
||||
|
||||
import (
|
||||
"errors"
|
||||
"io/fs"
|
||||
"os"
|
||||
"path/filepath"
|
||||
"strings"
|
||||
@@ -8,6 +10,11 @@ import (
|
||||
"golang.org/x/sys/windows"
|
||||
)
|
||||
|
||||
// UserHomeDir returns the home directory of the current user.
|
||||
func UserHomeDir() string {
|
||||
return KnownFolder(windows.FOLDERID_Profile, []string{"USERPROFILE"}, nil)
|
||||
}
|
||||
|
||||
// Exists returns true if the specified path exists.
|
||||
func Exists(path string) bool {
|
||||
fi, err := os.Lstat(path)
|
||||
@@ -15,12 +22,12 @@ func Exists(path string) bool {
|
||||
_, err = filepath.EvalSymlinks(path)
|
||||
}
|
||||
|
||||
return err == nil || os.IsExist(err)
|
||||
return err == nil || errors.Is(err, fs.ErrExist)
|
||||
}
|
||||
|
||||
// ExpandHome substitutes `%USERPROFILE%` at the start of the specified
|
||||
// `path` using the provided `home` location.
|
||||
func ExpandHome(path, home string) string {
|
||||
// ExpandHome substitutes `%USERPROFILE%` at the start of the specified `path`.
|
||||
func ExpandHome(path string) string {
|
||||
home := UserHomeDir()
|
||||
if path == "" || home == "" {
|
||||
return path
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user