chore: move everything out from src

This commit is contained in:
2025-03-03 06:52:47 +01:00
parent 469e737bb3
commit 23d1aaad55
19 changed files with 1 additions and 0 deletions

28
helpers/path.go Normal file
View File

@@ -0,0 +1,28 @@
package helpers
import (
"os"
"path/filepath"
"strings"
)
func ResolvePath(path string) string {
return ResolvePathWithDefault(path, "")
}
func ResolvePathWithDefault(path string, currentDirectory string) string {
skipCombiningCurrentDirectory := false
if strings.Contains(path, "~") {
home, err := os.UserHomeDir()
if err == nil {
path = strings.ReplaceAll(path, "~", home)
skipCombiningCurrentDirectory = true
}
}
if currentDirectory != "" && !skipCombiningCurrentDirectory {
path = filepath.Join(currentDirectory, path)
}
path = filepath.FromSlash(path)
return path
}