added ~ as home processing

This commit is contained in:
JISAUAY committed 2025-06-27 11:23:15 -05:00
1 parent 7062e798a9
commit 9e46cc9105
7 files changed
+79 -6

No files matched your search

+17
View File
@@ -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
}