forked from TrueCloudLab/frostfs-node
Move to frostfs-node
Signed-off-by: Pavel Karpy <p.karpy@yadro.com>
This commit is contained in:
parent
42554a9298
commit
923f84722a
934 changed files with 3470 additions and 3451 deletions
24
cmd/frostfs-adm/internal/modules/config/util.go
Normal file
24
cmd/frostfs-adm/internal/modules/config/util.go
Normal file
|
@ -0,0 +1,24 @@
|
|||
package config
|
||||
|
||||
import (
|
||||
"os"
|
||||
"path/filepath"
|
||||
"strings"
|
||||
)
|
||||
|
||||
// ResolveHomePath replaces leading `~`
|
||||
// with home directory.
|
||||
//
|
||||
// Does nothing if path does not start
|
||||
// with contain `~`.
|
||||
func ResolveHomePath(path string) string {
|
||||
homeDir, _ := os.UserHomeDir()
|
||||
|
||||
if path == "~" {
|
||||
path = homeDir
|
||||
} else if strings.HasPrefix(path, "~/") {
|
||||
path = filepath.Join(homeDir, path[2:])
|
||||
}
|
||||
|
||||
return path
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue