You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
21 lines
315 B
21 lines
315 B
package lib |
|
|
|
import ( |
|
"os" |
|
"path/filepath" |
|
"strings" |
|
) |
|
|
|
// ----------------------------------------- |
|
// public |
|
|
|
func ExpandPath(path string) string { |
|
if strings.HasPrefix(path, "~/") { |
|
home, err := os.UserHomeDir() |
|
if err != nil { |
|
return path |
|
} |
|
return filepath.Join(home, path[2:]) |
|
} |
|
return path |
|
}
|
|
|