1
// Copyright 2013 Canonical Ltd.
2
// Licensed under the AGPLv3, see LICENCE file for details.
12
// NormalizePath replaces a leading ~ with $HOME, and removes any .. or . path
14
func NormalizePath(dir string) string {
15
if strings.HasPrefix(dir, "~/") {
16
dir = filepath.Join(os.Getenv("HOME"), dir[2:])
18
return filepath.Clean(dir)