added ~ as home processing
This commit is contained in:
1 parent
7062e798a9
commit
9e46cc9105
7 files changed
+79
-6
No files matched your search
@@ -0,0 +1,17 @@
|
||||
package util
|
||||
|
||||
import (
|
||||
"os"
|
||||
"strings"
|
||||
)
|
||||
|
||||
func ExpandHome(path string) string {
|
||||
if strings.HasPrefix(path, "~") {
|
||||
home, err := os.UserHomeDir()
|
||||
if err == nil {
|
||||
return strings.Replace(path, "~", home, 1)
|
||||
}
|
||||
}
|
||||
|
||||
return path
|
||||
}
|
||||
Reference in new issue
Block a user