@@ -14,7 +14,7 @@ import (
1414)
1515
1616// path hierarchy for finding systemd service templates
17- var rootPaths = []string {"/var/lib/deis/ units" , "~/.deisctl /units" }
17+ var rootPaths = []string {"~/.deisctl/ units" , "/var/lib/deis /units" }
1818
1919// Units returns a list of units filtered by target
2020func (c * FleetClient ) Units (target string ) (units []string , err error ) {
@@ -119,7 +119,7 @@ func readTemplate(component string) (out []byte, err error) {
119119 } else {
120120 // otherwise look in rootPaths hierarchy
121121 for _ , rootPath := range rootPaths {
122- rootPath , _ := expandUser (rootPath )
122+ rootPath , _ := ExpandUser (rootPath )
123123 filename := path .Join (rootPath , templateName )
124124 if _ , err := os .Stat (filename ); err == nil {
125125 templateFile = filename
@@ -138,11 +138,11 @@ func readTemplate(component string) (out []byte, err error) {
138138 return
139139}
140140
141- // expandUser replaces "~" in a string with the current user's home directory.
142- func expandUser (path string ) (string , error ) {
141+ // ExpandUser replaces "~" in a string with the current user's home directory.
142+ func ExpandUser (path string ) (string , error ) {
143143 user , err := user .Current ()
144144 if err != nil {
145145 return path , err
146146 }
147- return strings .Replace (path , "~/" , user .HomeDir , 1 ), nil
147+ return strings .Replace (path , "~/" , user .HomeDir + "/" , 1 ), nil
148148}
0 commit comments