equal
deleted
inserted
replaced
89 } |
89 } |
90 |
90 |
91 func absPathify(inPath string) string { |
91 func absPathify(inPath string) string { |
92 jww.INFO.Println("Trying to resolve absolute path to", inPath) |
92 jww.INFO.Println("Trying to resolve absolute path to", inPath) |
93 |
93 |
94 if strings.HasPrefix(inPath, "$HOME") { |
94 if inPath == "$HOME" || strings.HasPrefix(inPath, "$HOME"+string(os.PathSeparator)) { |
95 inPath = userHomeDir() + inPath[5:] |
95 inPath = userHomeDir() + inPath[5:] |
96 } |
96 } |
97 |
97 |
98 if strings.HasPrefix(inPath, "$") { |
98 if strings.HasPrefix(inPath, "$") { |
99 end := strings.Index(inPath, string(os.PathSeparator)) |
99 end := strings.Index(inPath, string(os.PathSeparator)) |
100 inPath = os.Getenv(inPath[1:end]) + inPath[end:] |
100 |
|
101 var value, suffix string |
|
102 if end == -1 { |
|
103 value = os.Getenv(inPath[1:]) |
|
104 } else { |
|
105 value = os.Getenv(inPath[1:end]) |
|
106 suffix = inPath[end:] |
|
107 } |
|
108 |
|
109 inPath = value + suffix |
101 } |
110 } |
102 |
111 |
103 if filepath.IsAbs(inPath) { |
112 if filepath.IsAbs(inPath) { |
104 return filepath.Clean(inPath) |
113 return filepath.Clean(inPath) |
105 } |
114 } |