mirror of
https://github.com/jesseduffield/lazygit.git
synced 2025-08-06 11:02:41 +03:00
Switch to github.com/adrg/xdg
This commit is contained in:
committed by
Stefan Haller
parent
4302018437
commit
2118ecdf8e
29
vendor/github.com/adrg/xdg/internal/pathutil/pathutil_plan9.go
generated
vendored
Normal file
29
vendor/github.com/adrg/xdg/internal/pathutil/pathutil_plan9.go
generated
vendored
Normal file
@@ -0,0 +1,29 @@
|
||||
package pathutil
|
||||
|
||||
import (
|
||||
"os"
|
||||
"path/filepath"
|
||||
"strings"
|
||||
)
|
||||
|
||||
// Exists returns true if the specified path exists.
|
||||
func Exists(path string) bool {
|
||||
_, err := os.Stat(path)
|
||||
return err == nil || os.IsExist(err)
|
||||
}
|
||||
|
||||
// ExpandHome substitutes `~` and `$home` at the start of the specified
|
||||
// `path` using the provided `home` location.
|
||||
func ExpandHome(path, home string) string {
|
||||
if path == "" || home == "" {
|
||||
return path
|
||||
}
|
||||
if path[0] == '~' {
|
||||
return filepath.Join(home, path[1:])
|
||||
}
|
||||
if strings.HasPrefix(path, "$home") {
|
||||
return filepath.Join(home, path[5:])
|
||||
}
|
||||
|
||||
return path
|
||||
}
|
Reference in New Issue
Block a user