From 81b78068a75a23c73be607cbe6d4dc8b1539f831 Mon Sep 17 00:00:00 2001 From: Randall Winkhart Date: Thu, 16 Jan 2025 14:22:07 -0500 Subject: [PATCH] Add exported ExpandPathWithHome utility --- core/utilitiesMisc.go | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/core/utilitiesMisc.go b/core/utilitiesMisc.go index 9904154..ff9004e 100644 --- a/core/utilitiesMisc.go +++ b/core/utilitiesMisc.go @@ -155,3 +155,8 @@ func EntryIsNotEmpty(entryData []string) bool { } return false } + +// ExpandPathWithHome, given a path (as a string) containing "~", returns the path with "~" expanded to the user's home directory. +func ExpandPathWithHome(path string) string { + return strings.Replace(path, "~", Home, 1) +}